| 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/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/signin/fake_signin_manager.h" | 15 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
| 16 #include "chrome/browser/signin/signin_error_controller_factory.h" | 16 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 17 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
| 18 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 19 #include "chrome/browser/sync/profile_sync_service_mock.h" | 19 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/test/base/scoped_testing_local_state.h" | 24 #include "chrome/test/base/scoped_testing_local_state.h" |
| 25 #include "chrome/test/base/testing_browser_process.h" | 25 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // or not. The test parameter is a bool: whether or not to test with/ | 175 // or not. The test parameter is a bool: whether or not to test with/ |
| 176 // /ClientLogin enabled or not. | 176 // /ClientLogin enabled or not. |
| 177 class SyncSetupHandlerTest : public testing::Test { | 177 class SyncSetupHandlerTest : public testing::Test { |
| 178 public: | 178 public: |
| 179 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} | 179 SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} |
| 180 void SetUp() override { | 180 void SetUp() override { |
| 181 error_ = GoogleServiceAuthError::AuthErrorNone(); | 181 error_ = GoogleServiceAuthError::AuthErrorNone(); |
| 182 | 182 |
| 183 TestingProfile::Builder builder; | 183 TestingProfile::Builder builder; |
| 184 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 184 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
| 185 FakeSigninManagerBase::Build); | 185 BuildFakeSigninManagerBase); |
| 186 profile_ = builder.Build(); | 186 profile_ = builder.Build(); |
| 187 | 187 |
| 188 // Sign in the user. | 188 // Sign in the user. |
| 189 mock_signin_ = static_cast<SigninManagerBase*>( | 189 mock_signin_ = static_cast<SigninManagerBase*>( |
| 190 SigninManagerFactory::GetForProfile(profile_.get())); | 190 SigninManagerFactory::GetForProfile(profile_.get())); |
| 191 std::string username = GetTestUser(); | 191 std::string username = GetTestUser(); |
| 192 if (!username.empty()) | 192 if (!username.empty()) |
| 193 mock_signin_->SetAuthenticatedAccountInfo(username, username); | 193 mock_signin_->SetAuthenticatedAccountInfo(username, username); |
| 194 | 194 |
| 195 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 195 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 WillRepeatedly(Return(false)); | 987 WillRepeatedly(Return(false)); |
| 988 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); | 988 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); |
| 989 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); | 989 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); |
| 990 handler_->HandleConfigure(&list_args); | 990 handler_->HandleConfigure(&list_args); |
| 991 | 991 |
| 992 // Ensure that we navigated to the "done" state since we don't need a | 992 // Ensure that we navigated to the "done" state since we don't need a |
| 993 // passphrase. | 993 // passphrase. |
| 994 ExpectDone(); | 994 ExpectDone(); |
| 995 } | 995 } |
| 996 | 996 |
| OLD | NEW |