| Index: components/offline_pages/background/request_coordinator_unittest.cc
|
| diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
|
| index 18b0e67531f3e59c53536a571e5315dfab8a526b..63054409d767428d536d6a9d415a32b2b10dfad7 100644
|
| --- a/components/offline_pages/background/request_coordinator_unittest.cc
|
| +++ b/components/offline_pages/background/request_coordinator_unittest.cc
|
| @@ -30,6 +30,7 @@ namespace offline_pages {
|
|
|
| namespace {
|
| // put test constants here
|
| +const bool kIsBackgroundScheduled = true;
|
| const GURL kUrl1("http://universe.com/everything");
|
| const GURL kUrl2("http://universe.com/toinfinityandbeyond");
|
| const std::string kClientNamespace("bookmark");
|
| @@ -414,7 +415,8 @@ TEST_F(RequestCoordinatorTest, StartProcessingWithNoRequests) {
|
| base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction,
|
| base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| }
|
|
|
| TEST_F(RequestCoordinatorTest, StartProcessingWithRequestInProgress) {
|
| @@ -436,12 +438,14 @@ TEST_F(RequestCoordinatorTest, StartProcessingWithRequestInProgress) {
|
| EnableOfflinerCallback(false);
|
|
|
| // Sending the request to the offliner should make it busy.
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| PumpLoop();
|
| EXPECT_TRUE(is_busy());
|
|
|
| // Now trying to start processing on another request should return false.
|
| - EXPECT_FALSE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_FALSE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| }
|
|
|
| TEST_F(RequestCoordinatorTest, SavePageLater) {
|
| @@ -713,7 +717,8 @@ TEST_F(RequestCoordinatorTest, RequestNotPickedDisabledItemsRemain) {
|
| net::NetworkChangeNotifier::CONNECTION_3G);
|
| base::Callback<void(bool)> callback = base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction, base::Unretained(this));
|
| - coordinator()->StartProcessing(device_conditions, callback);
|
| + coordinator()->StartProcessing(kIsBackgroundScheduled, device_conditions,
|
| + callback);
|
| EXPECT_TRUE(is_starting());
|
|
|
| // Call RequestNotPicked, simulating a request on the disabled list.
|
| @@ -738,7 +743,8 @@ TEST_F(RequestCoordinatorTest, RequestNotPickedNonUserRequestedItemsRemain) {
|
| net::NetworkChangeNotifier::CONNECTION_3G);
|
| base::Callback<void(bool)> callback = base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction, base::Unretained(this));
|
| - coordinator()->StartProcessing(device_conditions, callback);
|
| + coordinator()->StartProcessing(kIsBackgroundScheduled, device_conditions,
|
| + callback);
|
| EXPECT_TRUE(is_starting());
|
|
|
| // Call RequestNotPicked, and make sure we pick schedule a task for non user
|
| @@ -814,7 +820,8 @@ TEST_F(RequestCoordinatorTest, StartProcessingWithLoadingDisabled) {
|
| base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction,
|
| base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
|
|
| // Let the async callbacks in the request coordinator run.
|
| PumpLoop();
|
| @@ -841,7 +848,8 @@ TEST_F(RequestCoordinatorTest, StartProcessingThenStopProcessingImmediately) {
|
| base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction,
|
| base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| EXPECT_TRUE(is_starting());
|
|
|
| // Now, quick, before it can do much (we haven't called PumpLoop), cancel it.
|
| @@ -881,7 +889,8 @@ TEST_F(RequestCoordinatorTest, StartProcessingThenStopProcessingLater) {
|
| base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction,
|
| base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| EXPECT_TRUE(is_starting());
|
|
|
| // Let all the async parts of the start processing pipeline run to completion.
|
| @@ -926,7 +935,8 @@ TEST_F(RequestCoordinatorTest, RemoveInflightRequest) {
|
| net::NetworkChangeNotifier::CONNECTION_3G);
|
| base::Callback<void(bool)> callback = base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction, base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
|
|
| // Let all the async parts of the start processing pipeline run to completion.
|
| PumpLoop();
|
| @@ -960,7 +970,8 @@ TEST_F(RequestCoordinatorTest, MarkRequestCompleted) {
|
| net::NetworkChangeNotifier::CONNECTION_3G);
|
| base::Callback<void(bool)> callback = base::Bind(
|
| &RequestCoordinatorTest::EmptyCallbackFunction, base::Unretained(this));
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
|
|
| // Call the method under test, making sure we send SUCCESS to the observer.
|
| coordinator()->MarkRequestCompleted(kRequestId1);
|
| @@ -999,7 +1010,8 @@ TEST_F(RequestCoordinatorTest, WatchdogTimeout) {
|
| SetOfflinerTimeoutForTest(base::TimeDelta::FromSeconds(kTestTimeoutSeconds));
|
|
|
| // Sending the request to the offliner.
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| PumpLoop();
|
|
|
| // Advance the mock clock far enough to cause a watchdog timeout
|
| @@ -1044,7 +1056,8 @@ TEST_F(RequestCoordinatorTest, TimeBudgetExceeded) {
|
| base::Unretained(this));
|
|
|
| // Sending the request to the offliner.
|
| - EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| + EXPECT_TRUE(coordinator()->StartProcessing(kIsBackgroundScheduled,
|
| + device_conditions, callback));
|
| PumpLoop();
|
|
|
| // Advance the mock clock far enough to exceed our time budget.
|
|
|