| 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.h" |
| 16 #include "chrome/browser/signin/profile_oauth2_token_service_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" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "components/signin/core/browser/fake_auth_status_provider.h" | 27 #include "components/signin/core/browser/fake_auth_status_provider.h" |
| 28 #include "components/signin/core/browser/profile_oauth2_token_service.h" | |
| 29 #include "components/signin/core/browser/signin_manager.h" | 28 #include "components/signin/core/browser/signin_manager.h" |
| 30 #include "components/sync_driver/sync_prefs.h" | 29 #include "components/sync_driver/sync_prefs.h" |
| 31 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
| 32 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 33 #include "content/public/test/test_browser_thread_bundle.h" | 32 #include "content/public/test/test_browser_thread_bundle.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 35 #include "ui/base/layout.h" | 34 #include "ui/base/layout.h" |
| 36 | 35 |
| 37 using ::testing::_; | 36 using ::testing::_; |
| 38 using ::testing::Mock; | 37 using ::testing::Mock; |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 860 |
| 862 // We do not display signin on chromeos in the case of auth error. | 861 // We do not display signin on chromeos in the case of auth error. |
| 863 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { | 862 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { |
| 864 // Initialize the system to a signed in state, but with an auth error. | 863 // Initialize the system to a signed in state, but with an auth error. |
| 865 error_ = GoogleServiceAuthError( | 864 error_ = GoogleServiceAuthError( |
| 866 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 865 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 867 | 866 |
| 868 SetupInitializedProfileSyncService(); | 867 SetupInitializedProfileSyncService(); |
| 869 mock_signin_->SetAuthenticatedUsername(kTestUser); | 868 mock_signin_->SetAuthenticatedUsername(kTestUser); |
| 870 FakeAuthStatusProvider provider( | 869 FakeAuthStatusProvider provider( |
| 871 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())-> | 870 SigninErrorControllerFactory::GetForProfile(profile_.get())); |
| 872 signin_error_controller()); | |
| 873 provider.SetAuthError(kTestUser, kTestUser, error_); | 871 provider.SetAuthError(kTestUser, kTestUser, error_); |
| 874 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 872 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 875 .WillRepeatedly(Return(true)); | 873 .WillRepeatedly(Return(true)); |
| 876 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 874 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
| 877 .WillRepeatedly(Return(true)); | 875 .WillRepeatedly(Return(true)); |
| 878 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 876 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
| 879 .WillRepeatedly(Return(false)); | 877 .WillRepeatedly(Return(false)); |
| 880 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) | 878 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
| 881 .WillRepeatedly(Return(false)); | 879 .WillRepeatedly(Return(false)); |
| 882 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); | 880 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 WillRepeatedly(Return(false)); | 1084 WillRepeatedly(Return(false)); |
| 1087 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); | 1085 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); |
| 1088 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); | 1086 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); |
| 1089 handler_->HandleConfigure(&list_args); | 1087 handler_->HandleConfigure(&list_args); |
| 1090 | 1088 |
| 1091 // Ensure that we navigated to the "done" state since we don't need a | 1089 // Ensure that we navigated to the "done" state since we don't need a |
| 1092 // passphrase. | 1090 // passphrase. |
| 1093 ExpectDone(); | 1091 ExpectDone(); |
| 1094 } | 1092 } |
| 1095 | 1093 |
| OLD | NEW |