| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_error_notifier_ash.h" |
| 6 | 6 |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateDesktop); | 61 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateDesktop); |
| 62 }; | 62 }; |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 class FakeLoginUIService: public LoginUIService { | 65 class FakeLoginUIService: public LoginUIService { |
| 66 public: | 66 public: |
| 67 FakeLoginUIService() : LoginUIService(NULL) {} | 67 FakeLoginUIService() : LoginUIService(NULL) {} |
| 68 virtual ~FakeLoginUIService() {} | 68 ~FakeLoginUIService() override {} |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 class FakeLoginUI : public LoginUIService::LoginUI { | 71 class FakeLoginUI : public LoginUIService::LoginUI { |
| 72 public: | 72 public: |
| 73 FakeLoginUI() : focus_ui_call_count_(0) {} | 73 FakeLoginUI() : focus_ui_call_count_(0) {} |
| 74 | 74 |
| 75 virtual ~FakeLoginUI() {} | 75 ~FakeLoginUI() override {} |
| 76 | 76 |
| 77 int focus_ui_call_count() const { return focus_ui_call_count_; } | 77 int focus_ui_call_count() const { return focus_ui_call_count_; } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // LoginUIService::LoginUI: | 80 // LoginUIService::LoginUI: |
| 81 virtual void FocusUI() override { | 81 void FocusUI() override { ++focus_ui_call_count_; } |
| 82 ++focus_ui_call_count_; | 82 void CloseUI() override {} |
| 83 } | |
| 84 virtual void CloseUI() override {} | |
| 85 | 83 |
| 86 int focus_ui_call_count_; | 84 int focus_ui_call_count_; |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 KeyedService* BuildMockLoginUIService( | 87 KeyedService* BuildMockLoginUIService( |
| 90 content::BrowserContext* profile) { | 88 content::BrowserContext* profile) { |
| 91 return new FakeLoginUIService(); | 89 return new FakeLoginUIService(); |
| 92 } | 90 } |
| 93 | 91 |
| 94 class SyncErrorNotifierTest : public AshTestBase { | 92 class SyncErrorNotifierTest : public AshTestBase { |
| 95 public: | 93 public: |
| 96 SyncErrorNotifierTest() {} | 94 SyncErrorNotifierTest() {} |
| 97 virtual ~SyncErrorNotifierTest() {} | 95 ~SyncErrorNotifierTest() override {} |
| 98 | 96 |
| 99 virtual void SetUp() override { | 97 void SetUp() override { |
| 100 profile_manager_.reset( | 98 profile_manager_.reset( |
| 101 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 99 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 102 ASSERT_TRUE(profile_manager_->SetUp()); | 100 ASSERT_TRUE(profile_manager_->SetUp()); |
| 103 | 101 |
| 104 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); | 102 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); |
| 105 | 103 |
| 106 TestingBrowserProcess::GetGlobal(); | 104 TestingBrowserProcess::GetGlobal(); |
| 107 AshTestBase::SetUp(); | 105 AshTestBase::SetUp(); |
| 108 | 106 |
| 109 // Set up a desktop screen for Windows to hold native widgets, used when | 107 // Set up a desktop screen for Windows to hold native widgets, used when |
| (...skipping 11 matching lines...) Expand all Loading... |
| 121 profile_, BuildMockLoginUIService)); | 119 profile_, BuildMockLoginUIService)); |
| 122 login_ui_service->SetLoginUI(&login_ui_); | 120 login_ui_service->SetLoginUI(&login_ui_); |
| 123 | 121 |
| 124 error_controller_.reset(new SyncErrorController(service_.get())); | 122 error_controller_.reset(new SyncErrorController(service_.get())); |
| 125 error_notifier_.reset(new SyncErrorNotifier(error_controller_.get(), | 123 error_notifier_.reset(new SyncErrorNotifier(error_controller_.get(), |
| 126 profile_)); | 124 profile_)); |
| 127 | 125 |
| 128 notification_ui_manager_ = g_browser_process->notification_ui_manager(); | 126 notification_ui_manager_ = g_browser_process->notification_ui_manager(); |
| 129 } | 127 } |
| 130 | 128 |
| 131 virtual void TearDown() override { | 129 void TearDown() override { |
| 132 error_notifier_->Shutdown(); | 130 error_notifier_->Shutdown(); |
| 133 service_.reset(); | 131 service_.reset(); |
| 134 #if defined(OS_WIN) | 132 #if defined(OS_WIN) |
| 135 test_screen_.reset(); | 133 test_screen_.reset(); |
| 136 #endif | 134 #endif |
| 137 profile_manager_.reset(); | 135 profile_manager_.reset(); |
| 138 | 136 |
| 139 AshTestBase::TearDown(); | 137 AshTestBase::TearDown(); |
| 140 } | 138 } |
| 141 | 139 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); | 230 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); |
| 233 VerifySyncErrorNotifierResult( | 231 VerifySyncErrorNotifierResult( |
| 234 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 232 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
| 235 false /* not signed in */, | 233 false /* not signed in */, |
| 236 false /* no error */); | 234 false /* no error */); |
| 237 } | 235 } |
| 238 } | 236 } |
| 239 | 237 |
| 240 } // namespace test | 238 } // namespace test |
| 241 } // namespace ash | 239 } // namespace ash |
| OLD | NEW |