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

Side by Side Diff: components/sync_driver/backup_rollback_controller_unittest.cc

Issue 1354883003: Componentize chrome/browser/sync/backup_rollback_controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated Created 5 years, 3 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/sync_driver/backup_rollback_controller.cc ('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 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/backup_rollback_controller.h" 5 #include "components/sync_driver/backup_rollback_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "components/sync_driver/signin_manager_wrapper.h" 12 #include "components/sync_driver/signin_manager_wrapper.h"
13 #include "components/sync_driver/sync_driver_switches.h" 13 #include "components/sync_driver/sync_driver_switches.h"
14 #include "components/sync_driver/sync_prefs.h" 14 #include "components/sync_driver/sync_prefs.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 protected: 54 protected:
55 void SetUp() override { 55 void SetUp() override {
56 backup_started_ = false; 56 backup_started_ = false;
57 rollback_started_ = false; 57 rollback_started_ = false;
58 58
59 EXPECT_CALL(signin_wrapper_, GetEffectiveUsername()) 59 EXPECT_CALL(signin_wrapper_, GetEffectiveUsername())
60 .WillRepeatedly(Return("")); 60 .WillRepeatedly(Return(""));
61 61
62 controller_.reset(new browser_sync::BackupRollbackController( 62 controller_.reset(new sync_driver::BackupRollbackController(
63 &fake_prefs_, &signin_wrapper_, 63 &fake_prefs_, &signin_wrapper_,
64 base::Bind(&BackupRollbackControllerTest::ControllerCallback, 64 base::Bind(&BackupRollbackControllerTest::ControllerCallback,
65 base::Unretained(this), true), 65 base::Unretained(this), true),
66 base::Bind(&BackupRollbackControllerTest::ControllerCallback, 66 base::Bind(&BackupRollbackControllerTest::ControllerCallback,
67 base::Unretained(this), false))); 67 base::Unretained(this), false)));
68 } 68 }
69 69
70 void PumpLoop() { 70 void PumpLoop() {
71 base::RunLoop run_loop; 71 base::RunLoop run_loop;
72 loop_.task_runner()->PostTask(FROM_HERE, run_loop.QuitClosure()); 72 loop_.task_runner()->PostTask(FROM_HERE, run_loop.QuitClosure());
73 run_loop.Run(); 73 run_loop.Run();
74 } 74 }
75 75
76 MockSigninManagerWrapper signin_wrapper_; 76 MockSigninManagerWrapper signin_wrapper_;
77 FakeSyncPrefs fake_prefs_; 77 FakeSyncPrefs fake_prefs_;
78 scoped_ptr<browser_sync::BackupRollbackController> controller_; 78 scoped_ptr<sync_driver::BackupRollbackController> controller_;
79 bool backup_started_; 79 bool backup_started_;
80 bool rollback_started_; 80 bool rollback_started_;
81 base::MessageLoop loop_; 81 base::MessageLoop loop_;
82 }; 82 };
83 83
84 TEST_F(BackupRollbackControllerTest, StartBackup) { 84 TEST_F(BackupRollbackControllerTest, StartBackup) {
85 EXPECT_TRUE(controller_->StartBackup()); 85 EXPECT_TRUE(controller_->StartBackup());
86 PumpLoop(); 86 PumpLoop();
87 EXPECT_TRUE(backup_started_); 87 EXPECT_TRUE(backup_started_);
88 } 88 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 EXPECT_FALSE(controller_->StartRollback()); 136 EXPECT_FALSE(controller_->StartRollback());
137 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries()); 137 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries());
138 138
139 PumpLoop(); 139 PumpLoop();
140 EXPECT_FALSE(rollback_started_); 140 EXPECT_FALSE(rollback_started_);
141 } 141 }
142 142
143 #endif 143 #endif
144 144
145 } // anonymous namespace 145 } // anonymous namespace
146
OLDNEW
« no previous file with comments | « components/sync_driver/backup_rollback_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698