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

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

Issue 2662103003: Always get device conditions from Java for every attempt. (Closed)
Patch Set: 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
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..5fe3b6386c0e17877ff8ce80c9fb7b9070b06104 100644
--- a/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc
+++ b/chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc
@@ -14,6 +14,11 @@
#include "components/offline_pages/core/offline_event_logger.h"
#include "net/base/network_change_notifier.h"
+namespace {
+const int kBatteryPercentageHigh = 75;
+const bool kPowerRequired = true;
+} // namespace
+
namespace offline_pages {
namespace android {
@@ -35,11 +40,7 @@ void GetAllRequestsDone(
Profile* profile = ProfileManager::GetLastUsedProfile();
RequestCoordinator* coordinator =
RequestCoordinatorFactory::GetInstance()->GetForBrowserContext(profile);
- // TODO(romax) Maybe get current real condition.
- DeviceConditions device_conditions(
- true, 0, net::NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI);
- coordinator->StartImmediateProcessing(device_conditions,
- base::Bind(&ProcessingDoneCallback));
+ coordinator->StartImmediateProcessing(base::Bind(&ProcessingDoneCallback));
}
}
@@ -52,6 +53,13 @@ void StartProcessing() {
} // namespace
+EvaluationTestScheduler::EvaluationTestScheduler()
+ : device_conditions_(kPowerRequired,
+ kBatteryPercentageHigh,
+ net::NetworkChangeNotifier::CONNECTION_2G) {}
+
+EvaluationTestScheduler::~EvaluationTestScheduler() {}
+
void EvaluationTestScheduler::Schedule(
const TriggerConditions& trigger_conditions) {
Profile* profile = ProfileManager::GetLastUsedProfile();
@@ -74,6 +82,10 @@ void EvaluationTestScheduler::BackupSchedule(
void EvaluationTestScheduler::Unschedule() {}
+DeviceConditions& EvaluationTestScheduler::GetCurrentDeviceConditions() {
+ return device_conditions_;
+}
+
void EvaluationTestScheduler::ImmediateScheduleCallback(bool result) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
base::Bind(&StartProcessing));

Powered by Google App Engine
This is Rietveld 408576698