Extract TaskTestBase from Prefetch, based on an offline discussion among carlosk@, petewil@ and romax@. This will make it easier to write unit tests for tasks, and providing a guarantee by checking whether tasks have been executed during TearDown.
Also apply the TaskTestBase in all task related unit tests in model/
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c39e772a093b608128cf5f1eda0db21d92eecf37 commit c39e772a093b608128cf5f1eda0db21d92eecf37 Author: Yafei Duan <romax@chromium.org> Date: Thu Jan 18 03:27:27 2018 [Offline Pages] Extract TastTestBase from Prefetch. Extracting TaskTestBase from prefetch/ to core/ as a higher level interface, in order to make it accessible by model/ as well. This will make it easier to write unit tests for tasks. Bug: 802892 Change-Id: I45e6053a928ba01e7191ceff959b11ee6a4e6f14 Reviewed-on: https://chromium-review.googlesource.com/868506 Reviewed-by: Peter Williamson <petewil@chromium.org> Commit-Queue: Yafei Duan <romax@chromium.org> Cr-Commit-Position: refs/heads/master@{#530041} [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/BUILD.gn [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/BUILD.gn [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/add_unique_urls_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/download_archives_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/download_cleanup_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/generate_page_bundle_reconcile_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/generate_page_bundle_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/get_operation_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/import_cleanup_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/import_completed_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/mark_operation_done_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/metrics_finalization_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/page_bundle_update_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/prefetch_download_flow_unittest.cc [add] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/prefetch_task_test_base.cc [rename] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/prefetch_task_test_base.h [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/sent_get_operation_cleanup_task_unittest.cc [modify] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/prefetch/stale_entry_finalizer_task_unittest.cc [delete] https://crrev.com/16b6bc1af03ebd94910b2fc1e665d6cee10733fe/components/offline_pages/core/prefetch/task_test_base.cc [add] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/task_test_base.cc [add] https://crrev.com/c39e772a093b608128cf5f1eda0db21d92eecf37/components/offline_pages/core/task_test_base.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/09383620b4f1d1885589933bf853bdf0f22030f4 commit 09383620b4f1d1885589933bf853bdf0f22030f4 Author: Dan Harrington <harringtond@chromium.org> Date: Tue Mar 13 00:17:54 2018 Add ModelTaskTestBase This cuts down on some of the boilerplate in task unit tests, and is similar to how the prefetch task tests are written. Also added TestTaskRunner in TestTaskBase, which is now used in prefetch task tests. Bug: 802892 Change-Id: I352713d3d9940965bbe0654af57093d12085f3a3 Reviewed-on: https://chromium-review.googlesource.com/953326 Reviewed-by: Carlos Knippschild <carlosk@chromium.org> Commit-Queue: Dan H <harringtond@chromium.org> Cr-Commit-Position: refs/heads/master@{#542662} [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/BUILD.gn [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/add_page_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/add_page_to_download_manager_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/clear_digest_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/clear_legacy_temporary_pages_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/clear_storage_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/complete_offline_page_upgrade_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/delete_page_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/get_pages_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/mark_page_accessed_task_unittest.cc [add] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/model_task_test_base.cc [add] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/model_task_test_base.h [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/offline_page_model_taskified_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/persistent_pages_consistency_check_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/start_offline_page_upgrade_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/model/temporary_pages_consistency_check_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/add_unique_urls_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/download_archives_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/download_cleanup_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/download_completed_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/finalize_dismissed_url_suggestion_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/generate_page_bundle_reconcile_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/generate_page_bundle_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/get_operation_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/import_archives_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/import_cleanup_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/import_completed_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/mark_operation_done_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/metrics_finalization_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/page_bundle_update_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/prefetch_task_test_base.h [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/sent_get_operation_cleanup_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/prefetch/stale_entry_finalizer_task_unittest.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/task_test_base.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/task_test_base.h [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/test_task_runner.cc [modify] https://crrev.com/09383620b4f1d1885589933bf853bdf0f22030f4/components/offline_pages/core/test_task_runner.h
This is fixed by harringtond@.
Comment 1 by romax@chromium.org
, Jan 18 2018