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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 class SyncSetupHandlerTest : public testing::Test { | 354 class SyncSetupHandlerTest : public testing::Test { |
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 error_ = GoogleServiceAuthError::None(); | 358 error_ = GoogleServiceAuthError::None(); |
359 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); | 359 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
360 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 360 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
361 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 361 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
362 profile_.get(), | 362 profile_.get(), |
363 ProfileSyncServiceMock::BuildMockProfileSyncService)); | 363 ProfileSyncServiceMock::BuildMockProfileSyncService)); |
| 364 mock_pss_->Initialize(); |
364 mock_signin_ = static_cast<SigninManagerMock*>( | 365 mock_signin_ = static_cast<SigninManagerMock*>( |
365 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( | 366 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
366 profile_.get(), BuildSigninManagerMock)); | 367 profile_.get(), BuildSigninManagerMock)); |
367 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); | 368 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); |
368 } | 369 } |
369 | 370 |
370 // Setup the expectations for calls made when displaying the config page. | 371 // Setup the expectations for calls made when displaying the config page. |
371 void SetDefaultExpectationsForConfigPage() { | 372 void SetDefaultExpectationsForConfigPage() { |
372 EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()). | 373 EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()). |
373 WillRepeatedly(Return(GetAllTypes())); | 374 WillRepeatedly(Return(GetAllTypes())); |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 DictionaryValue* dictionary; | 1140 DictionaryValue* dictionary; |
1140 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); | 1141 ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); |
1141 std::string err = l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED); | 1142 std::string err = l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED); |
1142 CheckShowSyncSetupArgs( | 1143 CheckShowSyncSetupArgs( |
1143 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1144 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
1144 handler_->CloseSyncSetup(); | 1145 handler_->CloseSyncSetup(); |
1145 EXPECT_EQ(NULL, | 1146 EXPECT_EQ(NULL, |
1146 LoginUIServiceFactory::GetForProfile( | 1147 LoginUIServiceFactory::GetForProfile( |
1147 profile_.get())->current_login_ui()); | 1148 profile_.get())->current_login_ui()); |
1148 } | 1149 } |
OLD | NEW |