| 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
| 6 #include "base/prefs/scoped_user_pref_update.h" | 6 #include "base/prefs/scoped_user_pref_update.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/signin/signin_names_io_thread.h" | 24 #include "chrome/browser/signin/signin_names_io_thread.h" |
| 25 #include "chrome/browser/signin/signin_promo.h" | 25 #include "chrome/browser/signin/signin_promo.h" |
| 26 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 26 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 27 #include "chrome/browser/sync/profile_sync_service_factory.h" | 27 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 28 #include "chrome/browser/sync/test_profile_sync_service.h" | 28 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 29 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 29 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 30 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 30 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 31 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 31 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "chrome/grit/chromium_strings.h" |
| 34 #include "chrome/grit/generated_resources.h" |
| 33 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 35 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 34 #include "chrome/test/base/testing_browser_process.h" | 36 #include "chrome/test/base/testing_browser_process.h" |
| 35 #include "chrome/test/base/testing_pref_service_syncable.h" | 37 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 36 #include "chrome/test/base/testing_profile.h" | 38 #include "chrome/test/base/testing_profile.h" |
| 37 #include "chrome/test/base/testing_profile_manager.h" | 39 #include "chrome/test/base/testing_profile_manager.h" |
| 38 #include "components/autofill/core/common/password_form.h" | 40 #include "components/autofill/core/common/password_form.h" |
| 39 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 41 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 40 #include "components/signin/core/browser/signin_manager.h" | 42 #include "components/signin/core/browser/signin_manager.h" |
| 41 #include "components/sync_driver/pref_names.h" | 43 #include "components/sync_driver/pref_names.h" |
| 42 #include "content/public/browser/browser_context.h" | 44 #include "content/public/browser/browser_context.h" |
| 43 #include "content/public/browser/navigation_details.h" | 45 #include "content/public/browser/navigation_details.h" |
| 44 #include "content/public/browser/navigation_entry.h" | 46 #include "content/public/browser/navigation_entry.h" |
| 45 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 46 #include "content/public/browser/web_contents_delegate.h" | 48 #include "content/public/browser/web_contents_delegate.h" |
| 47 #include "content/public/common/frame_navigate_params.h" | 49 #include "content/public/common/frame_navigate_params.h" |
| 48 #include "content/public/common/url_constants.h" | 50 #include "content/public/common/url_constants.h" |
| 49 #include "content/public/test/mock_render_process_host.h" | 51 #include "content/public/test/mock_render_process_host.h" |
| 50 #include "grit/chromium_strings.h" | |
| 51 #include "grit/generated_resources.h" | |
| 52 #include "testing/gmock/include/gmock/gmock.h" | 52 #include "testing/gmock/include/gmock/gmock.h" |
| 53 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
| 54 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
| 55 | 55 |
| 56 using ::testing::_; | 56 using ::testing::_; |
| 57 using ::testing::AtLeast; | 57 using ::testing::AtLeast; |
| 58 using ::testing::Return; | 58 using ::testing::Return; |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 // Used to confirm OneClickSigninHelper does not trigger redirect when there is | 62 // Used to confirm OneClickSigninHelper does not trigger redirect when there is |
| 63 // a pending navigation. | 63 // a pending navigation. |
| 64 class MockWebContentsDelegate : public content::WebContentsDelegate { | 64 class MockWebContentsDelegate : public content::WebContentsDelegate { |
| 65 public: | 65 public: |
| 66 MOCK_METHOD2(OpenURLFromTab, | 66 MOCK_METHOD2(OpenURLFromTab, |
| 67 content::WebContents*(content::WebContents* source, | 67 content::WebContents*(content::WebContents* source, |
| 68 const content::OpenURLParams& params)); | 68 const content::OpenURLParams& params)); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class SigninManagerMock : public FakeSigninManager { | 71 class SigninManagerMock : public FakeSigninManager { |
| 72 public: | 72 public: |
| 73 explicit SigninManagerMock(Profile* profile) : FakeSigninManager(profile) { | 73 explicit SigninManagerMock(Profile* profile) : FakeSigninManager(profile) { |
| 74 Initialize(NULL); | 74 Initialize(NULL); |
| 75 } | 75 } |
| 76 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username)); | 76 MOCK_CONST_METHOD1(IsAllowedUsername, bool(const std::string& username)); |
| 77 }; | 77 }; |
| 78 | 78 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 AcquireIsolatedMediaRequestContext( | 159 AcquireIsolatedMediaRequestContext( |
| 160 net::URLRequestContext* app_context, | 160 net::URLRequestContext* app_context, |
| 161 const StoragePartitionDescriptor& partition_descriptor) | 161 const StoragePartitionDescriptor& partition_descriptor) |
| 162 const OVERRIDE { | 162 const OVERRIDE { |
| 163 NOTREACHED(); | 163 NOTREACHED(); |
| 164 return NULL; | 164 return NULL; |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 class TestURLRequest : public base::SupportsUserData { | 168 class TestURLRequest : public base::SupportsUserData { |
| 169 public: | 169 public: |
| 170 TestURLRequest() {} | 170 TestURLRequest() {} |
| 171 virtual ~TestURLRequest() {} | 171 virtual ~TestURLRequest() {} |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 class OneClickTestProfileSyncService : public TestProfileSyncService { | 174 class OneClickTestProfileSyncService : public TestProfileSyncService { |
| 175 public: | 175 public: |
| 176 virtual ~OneClickTestProfileSyncService() {} | 176 virtual ~OneClickTestProfileSyncService() {} |
| 177 | 177 |
| 178 // Helper routine to be used in conjunction with | 178 // Helper routine to be used in conjunction with |
| 179 // BrowserContextKeyedServiceFactory::SetTestingFactory(). | 179 // BrowserContextKeyedServiceFactory::SetTestingFactory(). |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 args.email = "foo@gmail.com"; | 1014 args.email = "foo@gmail.com"; |
| 1015 args.profile = profile(); | 1015 args.profile = profile(); |
| 1016 MockStarterWrapper* wrapper = new MockStarterWrapper( | 1016 MockStarterWrapper* wrapper = new MockStarterWrapper( |
| 1017 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 1017 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
| 1018 SetCookie("LSID=1234; domain=google.com; secure; httponly"); | 1018 SetCookie("LSID=1234; domain=google.com; secure; httponly"); |
| 1019 | 1019 |
| 1020 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); | 1020 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); |
| 1021 wrapper->Start(); | 1021 wrapper->Start(); |
| 1022 base::RunLoop().RunUntilIdle(); | 1022 base::RunLoop().RunUntilIdle(); |
| 1023 } | 1023 } |
| OLD | NEW |