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

Side by Side Diff: components/offline_pages/core/background/scheduler_stub.cc

Issue 2662103003: Always get device conditions from Java for every attempt. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « components/offline_pages/core/background/scheduler_stub.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/offline_pages/core/background/scheduler_stub.h" 5 #include "components/offline_pages/core/background/scheduler_stub.h"
6 6
7 namespace {
8 const int kBatteryPercentageHigh = 75;
9 const bool kPowerRequired = true;
10 } // namespace
11
7 namespace offline_pages { 12 namespace offline_pages {
8 13
9 SchedulerStub::SchedulerStub() 14 SchedulerStub::SchedulerStub()
10 : schedule_called_(false), 15 : schedule_called_(false),
11 backup_schedule_called_(false), 16 backup_schedule_called_(false),
12 unschedule_called_(false), 17 unschedule_called_(false),
18 get_current_device_conditions_called_(false),
13 schedule_delay_(0L), 19 schedule_delay_(0L),
14 conditions_(false, 0, false) {} 20 device_conditions_(kPowerRequired,
21 kBatteryPercentageHigh,
22 net::NetworkChangeNotifier::CONNECTION_2G),
23 trigger_conditions_(false, 0, false) {}
15 24
16 SchedulerStub::~SchedulerStub() {} 25 SchedulerStub::~SchedulerStub() {}
17 26
18 void SchedulerStub::Schedule(const TriggerConditions& trigger_conditions) { 27 void SchedulerStub::Schedule(const TriggerConditions& trigger_conditions) {
19 schedule_called_ = true; 28 schedule_called_ = true;
20 conditions_ = trigger_conditions; 29 trigger_conditions_ = trigger_conditions;
21 } 30 }
22 31
23 void SchedulerStub::BackupSchedule(const TriggerConditions& trigger_conditions, 32 void SchedulerStub::BackupSchedule(const TriggerConditions& trigger_conditions,
24 long delay_in_seconds) { 33 long delay_in_seconds) {
25 backup_schedule_called_ = true; 34 backup_schedule_called_ = true;
26 schedule_delay_ = delay_in_seconds; 35 schedule_delay_ = delay_in_seconds;
27 conditions_ = trigger_conditions; 36 trigger_conditions_ = trigger_conditions;
28 } 37 }
29 38
30 void SchedulerStub::Unschedule() { 39 void SchedulerStub::Unschedule() {
31 unschedule_called_ = true; 40 unschedule_called_ = true;
32 } 41 }
33 42
43 const DeviceConditions& SchedulerStub::GetCurrentDeviceConditions() {
44 get_current_device_conditions_called_ = true;
45 return device_conditions_;
46 }
47
34 } // namespace offline_pages 48 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/core/background/scheduler_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698