OLD | NEW |
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 NULL; | 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); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |