Chromium Code Reviews| Index: chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc |
| diff --git a/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc b/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc |
| index 8aadb93d355e4c71c222e4c57d8909d062c4e689..c7872a63031551f0ad80c97a69fbb7a75ba79fbd 100644 |
| --- a/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc |
| +++ b/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc |
| @@ -37,13 +37,21 @@ void GetAllRequestsDone( |
| RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); |
| // TODO(romax) Maybe get current real condition. |
| DeviceConditions device_conditions( |
| - true, 0, net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); |
| + true, 0, net::NetworkChangeNotifier::GetConnectionType()); |
| coordinator->StartImmediateProcessing(device_conditions, |
| base::Bind(&ProcessingDoneCallback)); |
| } |
| } |
| void StartProcessing() { |
| + // If there's no network connection then try in 2 seconds. |
| + if (net::NetworkChangeNotifier::GetConnectionType() == |
| + net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) { |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, base::Bind(&StartProcessing), |
| + base::TimeDelta::FromSeconds(2)); |
| + return; |
| + } |
| Profile* profile = ProfileManager::GetLastUsedProfile(); |
| RequestCoordinator* coordinator = |
| RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile); |
| @@ -70,9 +78,19 @@ void EvaluationTestScheduler::Schedule( |
| void EvaluationTestScheduler::BackupSchedule( |
| const TriggerConditions& trigger_conditions, |
| - long delay_in_seconds) {} |
| + long delay_in_seconds) { |
| + // This method is not expected to be called in test harnees. Adding a log in |
|
Pete Williamson
2017/01/25 02:01:42
nit; harnees -> harness
Same comment for Unschedul
|
| + // case we somehow get called here and need to implement the method. |
| + coordinator_->GetLogger()->RecordActivity(std::string(kLogTag) + |
| + " BackupSchedule called!"); |
| +} |
| -void EvaluationTestScheduler::Unschedule() {} |
| +void EvaluationTestScheduler::Unschedule() { |
| + // This method is not expected to be called in test harnees. Adding a log in |
| + // case we somehow get called here and need to implement the method. |
| + coordinator_->GetLogger()->RecordActivity(std::string(kLogTag) + |
| + " Unschedule called!"); |
| +} |
| void EvaluationTestScheduler::ImmediateScheduleCallback(bool result) { |
| base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |