| 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 "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_mock.h" | 9 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 9 #include "chrome/browser/sync/sync_error_controller.h" | 10 #include "chrome/browser/sync/sync_error_controller.h" |
| 10 #include "chrome/browser/sync/sync_global_error_factory.h" | 11 #include "chrome/browser/sync/sync_global_error_factory.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 14 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 14 #include "chrome/test/base/browser_with_test_window_test.h" | 15 #include "chrome/test/base/browser_with_test_window_test.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 40 int focus_ui_call_count() const { return focus_ui_call_count_; } | 41 int focus_ui_call_count() const { return focus_ui_call_count_; } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // Overridden from LoginUIService::LoginUI: | 44 // Overridden from LoginUIService::LoginUI: |
| 44 void FocusUI() override { ++focus_ui_call_count_; } | 45 void FocusUI() override { ++focus_ui_call_count_; } |
| 45 void CloseUI() override {} | 46 void CloseUI() override {} |
| 46 | 47 |
| 47 int focus_ui_call_count_; | 48 int focus_ui_call_count_; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 KeyedService* BuildMockLoginUIService(content::BrowserContext* profile) { | 51 scoped_ptr<KeyedService> BuildMockLoginUIService( |
| 51 return new FakeLoginUIService(); | 52 content::BrowserContext* profile) { |
| 53 return make_scoped_ptr(new FakeLoginUIService()); |
| 52 } | 54 } |
| 53 | 55 |
| 54 // Same as BrowserWithTestWindowTest, but uses MockBrowser to test calls to | 56 // Same as BrowserWithTestWindowTest, but uses MockBrowser to test calls to |
| 55 // ExecuteCommand method. | 57 // ExecuteCommand method. |
| 56 class SyncGlobalErrorTest : public BrowserWithTestWindowTest { | 58 class SyncGlobalErrorTest : public BrowserWithTestWindowTest { |
| 57 public: | 59 public: |
| 58 SyncGlobalErrorTest() {} | 60 SyncGlobalErrorTest() {} |
| 59 ~SyncGlobalErrorTest() override {} | 61 ~SyncGlobalErrorTest() override {} |
| 60 | 62 |
| 61 void SetUp() override { | 63 void SetUp() override { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 .WillRepeatedly(Return(true)); | 159 .WillRepeatedly(Return(true)); |
| 158 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) | 160 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) |
| 159 .WillRepeatedly(Return(true)); | 161 .WillRepeatedly(Return(true)); |
| 160 VerifySyncGlobalErrorResult( | 162 VerifySyncGlobalErrorResult( |
| 161 &service, login_ui_service, browser(), &error, &global_error, | 163 &service, login_ui_service, browser(), &error, &global_error, |
| 162 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 164 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
| 163 false /* not signed in */, false /* no error */); | 165 false /* not signed in */, false /* no error */); |
| 164 | 166 |
| 165 global_error.Shutdown(); | 167 global_error.Shutdown(); |
| 166 } | 168 } |
| OLD | NEW |