OLD | NEW |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 // The boolean parameter indicates whether the test is run with ClientOAuth | 351 // The boolean parameter indicates whether the test is run with ClientOAuth |
352 // or not. | 352 // or not. |
353 class SyncSetupHandlerTest : public testing::TestWithParam<bool> { | 353 class SyncSetupHandlerTest : public testing::TestWithParam<bool> { |
354 public: | 354 public: |
355 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} | 355 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} |
356 virtual void SetUp() OVERRIDE { | 356 virtual void SetUp() OVERRIDE { |
357 // If the parameter is true, then use ClientOAuth for the tests. Otherwise | 357 // If the parameter is true, then use ClientOAuth for the tests. Otherwise |
358 // use ClientLogin for the tests. | 358 // use ClientLogin for the tests. |
359 if (GetParam()) { | 359 if (GetParam()) { |
| 360 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 361 switches::kEnableClientOAuthSignin); |
| 362 } else { |
360 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( | 363 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( |
361 switches::kDisableClientOAuthSignin)); | 364 switches::kEnableClientOAuthSignin)); |
362 } else { | |
363 CommandLine::ForCurrentProcess()->AppendSwitch( | |
364 switches::kDisableClientOAuthSignin); | |
365 } | 365 } |
366 | 366 |
367 error_ = GoogleServiceAuthError::None(); | 367 error_ = GoogleServiceAuthError::None(); |
368 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); | 368 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
369 SyncPromoUI::RegisterUserPrefs(profile_->GetPrefs()); | 369 SyncPromoUI::RegisterUserPrefs(profile_->GetPrefs()); |
370 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 370 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
371 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 371 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
372 profile_.get(), | 372 profile_.get(), |
373 ProfileSyncServiceMock::BuildMockProfileSyncService)); | 373 ProfileSyncServiceMock::BuildMockProfileSyncService)); |
374 mock_signin_ = static_cast<SigninManagerMock*>( | 374 mock_signin_ = static_cast<SigninManagerMock*>( |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 CheckShowSyncSetupArgs( | 1150 CheckShowSyncSetupArgs( |
1151 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1151 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
1152 handler_->CloseSyncSetup(); | 1152 handler_->CloseSyncSetup(); |
1153 EXPECT_EQ(NULL, | 1153 EXPECT_EQ(NULL, |
1154 LoginUIServiceFactory::GetForProfile( | 1154 LoginUIServiceFactory::GetForProfile( |
1155 profile_.get())->current_login_ui()); | 1155 profile_.get())->current_login_ui()); |
1156 } | 1156 } |
1157 | 1157 |
1158 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, | 1158 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, |
1159 Values(true, false)); | 1159 Values(true, false)); |
OLD | NEW |