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

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

Issue 2659813006: Always get device conditions from Java for every attempt. (Closed)
Patch Set: fixes per DewittJ 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 e782d7fc42c510602e8c5ca1acb739bae1ec4963..142b2e1134d1b64b111ae745fb1f85846d9f1090 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::GetConnectionType());
- coordinator->StartImmediateProcessing(device_conditions,
- base::Bind(&ProcessingDoneCallback));
+ coordinator->StartImmediateProcessing(base::Bind(&ProcessingDoneCallback));
}
}
@@ -60,6 +61,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();
@@ -92,6 +100,10 @@ void EvaluationTestScheduler::Unschedule() {
" Unschedule called!");
}
+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