| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 362 switches::kEnableClientOAuthSignin); |
| 363 } else { |
| 361 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( | 364 ASSERT_FALSE(CommandLine::ForCurrentProcess()->HasSwitch( |
| 362 switches::kDisableClientOAuthSignin)); | 365 switches::kEnableClientOAuthSignin)); |
| 363 } else { | |
| 364 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 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 SyncPromoUI::RegisterUserPrefs(profile_->GetPrefs()); |
| 371 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 371 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
| 372 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 372 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 373 profile_.get(), | 373 profile_.get(), |
| 374 ProfileSyncServiceMock::BuildMockProfileSyncService)); | 374 ProfileSyncServiceMock::BuildMockProfileSyncService)); |
| 375 mock_signin_ = static_cast<SigninManagerMock*>( | 375 mock_signin_ = static_cast<SigninManagerMock*>( |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 CheckShowSyncSetupArgs( | 1153 CheckShowSyncSetupArgs( |
| 1154 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1154 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
| 1155 handler_->CloseSyncSetup(); | 1155 handler_->CloseSyncSetup(); |
| 1156 EXPECT_EQ(NULL, | 1156 EXPECT_EQ(NULL, |
| 1157 LoginUIServiceFactory::GetForProfile( | 1157 LoginUIServiceFactory::GetForProfile( |
| 1158 profile_.get())->current_login_ui()); | 1158 profile_.get())->current_login_ui()); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, | 1161 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, |
| 1162 Values(true, false)); | 1162 Values(true, false)); |
| OLD | NEW |