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

Side by Side Diff: chrome/browser/sync_file_system/sync_process_runner_unittest.cc

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/sync_file_system/sync_process_runner.h" 5 #include "chrome/browser/sync_file_system/sync_process_runner.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace sync_file_system { 12 namespace sync_file_system {
13 13
14 namespace { 14 namespace {
15 15
16 class FakeClient : public SyncProcessRunner::Client { 16 class FakeClient : public SyncProcessRunner::Client {
17 public: 17 public:
18 FakeClient() : service_state_(SYNC_SERVICE_RUNNING) {} 18 FakeClient() : service_state_(SYNC_SERVICE_RUNNING) {}
19 virtual ~FakeClient() {} 19 virtual ~FakeClient() {}
20 20
21 virtual SyncServiceState GetSyncServiceState() OVERRIDE { 21 virtual SyncServiceState GetSyncServiceState() override {
22 return service_state_; 22 return service_state_;
23 } 23 }
24 24
25 virtual SyncFileSystemService* GetSyncService() OVERRIDE { 25 virtual SyncFileSystemService* GetSyncService() override {
26 return nullptr; 26 return nullptr;
27 } 27 }
28 28
29 void set_service_state(SyncServiceState service_state) { 29 void set_service_state(SyncServiceState service_state) {
30 service_state_ = service_state; 30 service_state_ = service_state;
31 } 31 }
32 32
33 private: 33 private:
34 SyncServiceState service_state_; 34 SyncServiceState service_state_;
35 35
36 DISALLOW_COPY_AND_ASSIGN(FakeClient); 36 DISALLOW_COPY_AND_ASSIGN(FakeClient);
37 }; 37 };
38 38
39 class FakeTimerHelper : public SyncProcessRunner::TimerHelper { 39 class FakeTimerHelper : public SyncProcessRunner::TimerHelper {
40 public: 40 public:
41 FakeTimerHelper() {} 41 FakeTimerHelper() {}
42 virtual ~FakeTimerHelper() {} 42 virtual ~FakeTimerHelper() {}
43 43
44 virtual bool IsRunning() OVERRIDE { 44 virtual bool IsRunning() override {
45 return !timer_task_.is_null(); 45 return !timer_task_.is_null();
46 } 46 }
47 47
48 virtual void Start(const tracked_objects::Location& from_here, 48 virtual void Start(const tracked_objects::Location& from_here,
49 const base::TimeDelta& delay, 49 const base::TimeDelta& delay,
50 const base::Closure& closure) OVERRIDE { 50 const base::Closure& closure) override {
51 scheduled_time_ = current_time_ + delay; 51 scheduled_time_ = current_time_ + delay;
52 timer_task_ = closure; 52 timer_task_ = closure;
53 } 53 }
54 54
55 virtual base::TimeTicks Now() const OVERRIDE { 55 virtual base::TimeTicks Now() const override {
56 return current_time_; 56 return current_time_;
57 } 57 }
58 58
59 void SetCurrentTime(const base::TimeTicks& current_time) { 59 void SetCurrentTime(const base::TimeTicks& current_time) {
60 current_time_ = current_time; 60 current_time_ = current_time;
61 if (current_time_ < scheduled_time_ || timer_task_.is_null()) 61 if (current_time_ < scheduled_time_ || timer_task_.is_null())
62 return; 62 return;
63 63
64 base::Closure task = timer_task_; 64 base::Closure task = timer_task_;
65 timer_task_.Reset(); 65 timer_task_.Reset();
(...skipping 21 matching lines...) Expand all
87 public: 87 public:
88 FakeSyncProcessRunner(SyncProcessRunner::Client* client, 88 FakeSyncProcessRunner(SyncProcessRunner::Client* client,
89 scoped_ptr<TimerHelper> timer_helper, 89 scoped_ptr<TimerHelper> timer_helper,
90 size_t max_parallel_task) 90 size_t max_parallel_task)
91 : SyncProcessRunner("FakeSyncProcess", 91 : SyncProcessRunner("FakeSyncProcess",
92 client, timer_helper.Pass(), 92 client, timer_helper.Pass(),
93 max_parallel_task), 93 max_parallel_task),
94 max_parallel_task_(max_parallel_task) { 94 max_parallel_task_(max_parallel_task) {
95 } 95 }
96 96
97 virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE { 97 virtual void StartSync(const SyncStatusCallback& callback) override {
98 EXPECT_LT(running_tasks_.size(), max_parallel_task_); 98 EXPECT_LT(running_tasks_.size(), max_parallel_task_);
99 running_tasks_.push(callback); 99 running_tasks_.push(callback);
100 } 100 }
101 101
102 virtual ~FakeSyncProcessRunner() { 102 virtual ~FakeSyncProcessRunner() {
103 } 103 }
104 104
105 void UpdateChanges(int num_changes) { 105 void UpdateChanges(int num_changes) {
106 OnChangesUpdated(num_changes); 106 OnChangesUpdated(num_changes);
107 } 107 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 // Then, following failing task should not extend throttling period. 269 // Then, following failing task should not extend throttling period.
270 fake_timer->AdvanceToScheduledTime(); 270 fake_timer->AdvanceToScheduledTime();
271 fake_client.set_service_state(SYNC_SERVICE_TEMPORARY_UNAVAILABLE); 271 fake_client.set_service_state(SYNC_SERVICE_TEMPORARY_UNAVAILABLE);
272 fake_runner.CompleteTask(SYNC_STATUS_FAILED); 272 fake_runner.CompleteTask(SYNC_STATUS_FAILED);
273 EXPECT_EQ(SyncProcessRunner::kSyncDelaySlowInMilliseconds, 273 EXPECT_EQ(SyncProcessRunner::kSyncDelaySlowInMilliseconds,
274 fake_timer->GetCurrentDelay()); 274 fake_timer->GetCurrentDelay());
275 } 275 }
276 276
277 } // namespace sync_file_system 277 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/sync_process_runner.cc ('k') | chrome/browser/tab_contents/background_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698