Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc

Issue 2658513004: [Offline Pages] Adding a network check in test scheduler. (Closed)
Patch Set: comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e782d7fc42c510602e8c5ca1acb739bae1ec4963 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 harness. Adding a log in
+ // 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 harness. 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698