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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler_unittest.cc

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 virtual Profile* GetProfile() const OVERRIDE { return profile_; } 334 virtual Profile* GetProfile() const OVERRIDE { return profile_; }
335 335
336 private: 336 private:
337 // Weak pointer to parent profile. 337 // Weak pointer to parent profile.
338 Profile* profile_; 338 Profile* profile_;
339 DISALLOW_COPY_AND_ASSIGN(TestingSyncSetupHandler); 339 DISALLOW_COPY_AND_ASSIGN(TestingSyncSetupHandler);
340 }; 340 };
341 341
342 class SigninManagerMock : public FakeSigninManager { 342 class SigninManagerMock : public FakeSigninManager {
343 public: 343 public:
344 explicit SigninManagerMock(Profile* profile) : FakeSigninManager(profile) {} 344 SigninManagerMock() {}
345 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username)); 345 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username));
346 }; 346 };
347 347
348 static ProfileKeyedService* BuildSigninManagerMock(Profile* profile) { 348 static ProfileKeyedService* BuildSigninManagerMock(Profile* profile) {
349 return new SigninManagerMock(profile); 349 return new SigninManagerMock();
350 } 350 }
351 351
352 // The boolean parameter indicates whether the test is run with ClientOAuth 352 // The boolean parameter indicates whether the test is run with ClientOAuth
353 // or not. 353 // or not.
354 class SyncSetupHandlerTest : public testing::TestWithParam<bool> { 354 class SyncSetupHandlerTest : public testing::TestWithParam<bool> {
355 public: 355 public:
356 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} 356 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {}
357 virtual void SetUp() OVERRIDE { 357 virtual void SetUp() OVERRIDE {
358 // If the parameter is true, then use ClientOAuth for the tests. Otherwise 358 // If the parameter is true, then use ClientOAuth for the tests. Otherwise
359 // use ClientLogin for the tests. 359 // use ClientLogin for the tests.
360 if (GetParam()) { 360 if (GetParam()) {
361 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( 361 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch(
362 switches::kDisableClientOAuthSignin)); 362 switches::kDisableClientOAuthSignin));
363 } else { 363 } else {
364 CommandLine::ForCurrentProcess()->AppendSwitch( 364 CommandLine::ForCurrentProcess()->AppendSwitch(
365 switches::kDisableClientOAuthSignin); 365 switches::kDisableClientOAuthSignin);
366 } 366 }
367 367
368 error_ = GoogleServiceAuthError::None(); 368 error_ = GoogleServiceAuthError::None();
369 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); 369 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile());
370 SyncPromoUI::RegisterUserPrefs(profile_->GetPrefs());
370 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 371 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
371 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 372 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
372 profile_.get(), 373 profile_.get(),
373 ProfileSyncServiceMock::BuildMockProfileSyncService)); 374 ProfileSyncServiceMock::BuildMockProfileSyncService));
374 mock_signin_ = static_cast<SigninManagerMock*>( 375 mock_signin_ = static_cast<SigninManagerMock*>(
375 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( 376 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse(
376 profile_.get(), BuildSigninManagerMock)); 377 profile_.get(), BuildSigninManagerMock));
377 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); 378 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get()));
378 } 379 }
379 380
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 CheckShowSyncSetupArgs( 1153 CheckShowSyncSetupArgs(
1153 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); 1154 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, "");
1154 handler_->CloseSyncSetup(); 1155 handler_->CloseSyncSetup();
1155 EXPECT_EQ(NULL, 1156 EXPECT_EQ(NULL,
1156 LoginUIServiceFactory::GetForProfile( 1157 LoginUIServiceFactory::GetForProfile(
1157 profile_.get())->current_login_ui()); 1158 profile_.get())->current_login_ui());
1158 } 1159 }
1159 1160
1160 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, 1161 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest,
1161 Values(true, false)); 1162 Values(true, false));
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698