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 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*>( |
375 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( | 375 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 CheckShowSyncSetupArgs( | 1152 CheckShowSyncSetupArgs( |
1153 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1153 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
1154 handler_->CloseSyncSetup(); | 1154 handler_->CloseSyncSetup(); |
1155 EXPECT_EQ(NULL, | 1155 EXPECT_EQ(NULL, |
1156 LoginUIServiceFactory::GetForProfile( | 1156 LoginUIServiceFactory::GetForProfile( |
1157 profile_.get())->current_login_ui()); | 1157 profile_.get())->current_login_ui()); |
1158 } | 1158 } |
1159 | 1159 |
1160 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, | 1160 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTest, SyncSetupHandlerTest, |
1161 Values(true, false)); | 1161 Values(true, false)); |
OLD | NEW |