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

Side by Side Diff: chrome/browser/sync/backup_rollback_controller_unittest.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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/backup_rollback_controller.h" 5 #include "chrome/browser/sync/backup_rollback_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 base::MessageLoop loop_; 80 base::MessageLoop loop_;
81 }; 81 };
82 82
83 TEST_F(BackupRollbackControllerTest, StartBackup) { 83 TEST_F(BackupRollbackControllerTest, StartBackup) {
84 EXPECT_TRUE(controller_->StartBackup()); 84 EXPECT_TRUE(controller_->StartBackup());
85 PumpLoop(); 85 PumpLoop();
86 EXPECT_TRUE(backup_started_); 86 EXPECT_TRUE(backup_started_);
87 } 87 }
88 88
89 TEST_F(BackupRollbackControllerTest, NoBackupIfDisabled) { 89 TEST_F(BackupRollbackControllerTest, NoBackupIfDisabled) {
90 CommandLine::ForCurrentProcess()->AppendSwitch( 90 base::CommandLine::ForCurrentProcess()->AppendSwitch(
91 switches::kSyncDisableBackup); 91 switches::kSyncDisableBackup);
92 92
93 base::RunLoop run_loop; 93 base::RunLoop run_loop;
94 EXPECT_FALSE(controller_->StartBackup()); 94 EXPECT_FALSE(controller_->StartBackup());
95 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); 95 loop_.PostTask(FROM_HERE, run_loop.QuitClosure());
96 run_loop.Run(); 96 run_loop.Run();
97 EXPECT_FALSE(backup_started_); 97 EXPECT_FALSE(backup_started_);
98 } 98 }
99 99
100 TEST_F(BackupRollbackControllerTest, StartRollback) { 100 TEST_F(BackupRollbackControllerTest, StartRollback) {
101 fake_prefs_.SetRemainingRollbackTries(1); 101 fake_prefs_.SetRemainingRollbackTries(1);
(...skipping 21 matching lines...) Expand all
123 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries()); 123 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries());
124 124
125 PumpLoop(); 125 PumpLoop();
126 EXPECT_FALSE(backup_started_); 126 EXPECT_FALSE(backup_started_);
127 EXPECT_FALSE(rollback_started_); 127 EXPECT_FALSE(rollback_started_);
128 } 128 }
129 129
130 TEST_F(BackupRollbackControllerTest, NoRollbackIfDisabled) { 130 TEST_F(BackupRollbackControllerTest, NoRollbackIfDisabled) {
131 fake_prefs_.SetRemainingRollbackTries(1); 131 fake_prefs_.SetRemainingRollbackTries(1);
132 132
133 CommandLine::ForCurrentProcess()->AppendSwitch( 133 base::CommandLine::ForCurrentProcess()->AppendSwitch(
134 switches::kSyncDisableRollback); 134 switches::kSyncDisableRollback);
135 EXPECT_FALSE(controller_->StartRollback()); 135 EXPECT_FALSE(controller_->StartRollback());
136 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries()); 136 EXPECT_EQ(0, fake_prefs_.GetRemainingRollbackTries());
137 137
138 PumpLoop(); 138 PumpLoop();
139 EXPECT_FALSE(rollback_started_); 139 EXPECT_FALSE(rollback_started_);
140 } 140 }
141 141
142 #endif 142 #endif
143 143
144 } // anonymous namespace 144 } // anonymous namespace
145 145
OLDNEW
« no previous file with comments | « chrome/browser/sync/backup_rollback_controller.cc ('k') | chrome/browser/sync/glue/sync_backend_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698