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/sync/sync_global_error.h" | 5 #include "chrome/browser/sync/sync_global_error.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/sync/profile_sync_test_util.h" | 11 #include "chrome/browser/sync/profile_sync_test_util.h" |
12 #include "chrome/browser/sync/sync_global_error_factory.h" | 12 #include "chrome/browser/sync/sync_global_error_factory.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 14 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
17 #include "chrome/test/base/browser_with_test_window_test.h" | 17 #include "chrome/test/base/browser_with_test_window_test.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "components/signin/core/common/profile_management_switches.h" | |
19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 using ::testing::NiceMock; | 26 using ::testing::NiceMock; |
26 using ::testing::Return; | 27 using ::testing::Return; |
27 using ::testing::ReturnRef; | 28 using ::testing::ReturnRef; |
28 using ::testing::_; | 29 using ::testing::_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 ASSERT_GT(login_ui->focus_ui_call_count(), 0); | 117 ASSERT_GT(login_ui->focus_ui_call_count(), 0); |
117 global_error->BubbleViewAcceptButtonPressed(browser); | 118 global_error->BubbleViewAcceptButtonPressed(browser); |
118 global_error->BubbleViewDidClose(browser); | 119 global_error->BubbleViewDidClose(browser); |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 } // namespace | 123 } // namespace |
123 | 124 |
124 // Test that SyncGlobalError shows an error if a passphrase is required. | 125 // Test that SyncGlobalError shows an error if a passphrase is required. |
125 TEST_F(SyncGlobalErrorTest, PassphraseGlobalError) { | 126 TEST_F(SyncGlobalErrorTest, PassphraseGlobalError) { |
127 // The MD User Menu displays Sync errors in a different way and should be the | |
128 // only one to do so. Under that paradigm, this test is obsolete. | |
129 if (switches::IsMaterialDesignUserMenu()) | |
maxbogue
2016/10/06 19:22:36
Presumably at some point this switch will be remov
anthonyvd
2016/10/06 19:25:44
Absolutely. There's going to be some clean up invo
| |
130 return; | |
131 | |
126 browser_sync::ProfileSyncServiceMock service( | 132 browser_sync::ProfileSyncServiceMock service( |
127 CreateProfileSyncServiceParamsForTest(profile())); | 133 CreateProfileSyncServiceParamsForTest(profile())); |
128 | 134 |
129 FakeLoginUIService* login_ui_service = static_cast<FakeLoginUIService*>( | 135 FakeLoginUIService* login_ui_service = static_cast<FakeLoginUIService*>( |
130 LoginUIServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 136 LoginUIServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
131 profile(), BuildMockLoginUIService)); | 137 profile(), BuildMockLoginUIService)); |
132 FakeLoginUI login_ui; | 138 FakeLoginUI login_ui; |
133 login_ui_service->SetLoginUI(&login_ui); | 139 login_ui_service->SetLoginUI(&login_ui); |
134 | 140 |
135 syncer::SyncErrorController error(&service); | 141 syncer::SyncErrorController error(&service); |
(...skipping 27 matching lines...) Expand all Loading... | |
163 .WillRepeatedly(Return(true)); | 169 .WillRepeatedly(Return(true)); |
164 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) | 170 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) |
165 .WillRepeatedly(Return(true)); | 171 .WillRepeatedly(Return(true)); |
166 VerifySyncGlobalErrorResult( | 172 VerifySyncGlobalErrorResult( |
167 &service, login_ui_service, browser(), &error, &global_error, | 173 &service, login_ui_service, browser(), &error, &global_error, |
168 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 174 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
169 false /* not signed in */, false /* no error */); | 175 false /* not signed in */, false /* no error */); |
170 | 176 |
171 global_error.Shutdown(); | 177 global_error.Shutdown(); |
172 } | 178 } |
OLD | NEW |