| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/ptr_util.h" |
| 12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 13 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
| 15 #include "chrome/browser/notifications/notification_ui_manager.h" | 17 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 16 #include "chrome/browser/sync/profile_sync_test_util.h" | 18 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 17 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int focus_ui_call_count() const { return focus_ui_call_count_; } | 65 int focus_ui_call_count() const { return focus_ui_call_count_; } |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 // LoginUIService::LoginUI: | 68 // LoginUIService::LoginUI: |
| 67 void FocusUI() override { ++focus_ui_call_count_; } | 69 void FocusUI() override { ++focus_ui_call_count_; } |
| 68 void CloseUI() override {} | 70 void CloseUI() override {} |
| 69 | 71 |
| 70 int focus_ui_call_count_; | 72 int focus_ui_call_count_; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 scoped_ptr<KeyedService> BuildMockLoginUIService( | 75 std::unique_ptr<KeyedService> BuildMockLoginUIService( |
| 74 content::BrowserContext* profile) { | 76 content::BrowserContext* profile) { |
| 75 return make_scoped_ptr(new FakeLoginUIService()); | 77 return base::WrapUnique(new FakeLoginUIService()); |
| 76 } | 78 } |
| 77 | 79 |
| 78 class SyncErrorNotifierTest : public AshTestBase { | 80 class SyncErrorNotifierTest : public AshTestBase { |
| 79 public: | 81 public: |
| 80 SyncErrorNotifierTest() {} | 82 SyncErrorNotifierTest() {} |
| 81 ~SyncErrorNotifierTest() override {} | 83 ~SyncErrorNotifierTest() override {} |
| 82 | 84 |
| 83 void SetUp() override { | 85 void SetUp() override { |
| 84 DCHECK(TestingBrowserProcess::GetGlobal()); | 86 DCHECK(TestingBrowserProcess::GetGlobal()); |
| 85 | 87 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 ASSERT_TRUE(notification); | 152 ASSERT_TRUE(notification); |
| 151 ASSERT_FALSE(notification->title().empty()); | 153 ASSERT_FALSE(notification->title().empty()); |
| 152 ASSERT_FALSE(notification->title().empty()); | 154 ASSERT_FALSE(notification->title().empty()); |
| 153 ASSERT_EQ((size_t)1, notification->buttons().size()); | 155 ASSERT_EQ((size_t)1, notification->buttons().size()); |
| 154 } else { | 156 } else { |
| 155 ASSERT_FALSE(notification); | 157 ASSERT_FALSE(notification); |
| 156 } | 158 } |
| 157 } | 159 } |
| 158 | 160 |
| 159 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| 160 scoped_ptr<gfx::Screen> test_screen_; | 162 std::unique_ptr<gfx::Screen> test_screen_; |
| 161 #endif | 163 #endif |
| 162 scoped_ptr<TestingProfileManager> profile_manager_; | 164 std::unique_ptr<TestingProfileManager> profile_manager_; |
| 163 scoped_ptr<SyncErrorController> error_controller_; | 165 std::unique_ptr<SyncErrorController> error_controller_; |
| 164 scoped_ptr<SyncErrorNotifier> error_notifier_; | 166 std::unique_ptr<SyncErrorNotifier> error_notifier_; |
| 165 scoped_ptr<ProfileSyncServiceMock> service_; | 167 std::unique_ptr<ProfileSyncServiceMock> service_; |
| 166 TestingProfile* profile_; | 168 TestingProfile* profile_; |
| 167 FakeLoginUI login_ui_; | 169 FakeLoginUI login_ui_; |
| 168 NotificationUIManager* notification_ui_manager_; | 170 NotificationUIManager* notification_ui_manager_; |
| 169 | 171 |
| 170 private: | 172 private: |
| 171 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest); | 173 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest); |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 } // namespace | 176 } // namespace |
| 175 | 177 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); | 223 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); |
| 222 VerifySyncErrorNotifierResult( | 224 VerifySyncErrorNotifierResult( |
| 223 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 225 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
| 224 false /* not signed in */, | 226 false /* not signed in */, |
| 225 false /* no error */); | 227 false /* no error */); |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 | 230 |
| 229 } // namespace test | 231 } // namespace test |
| 230 } // namespace ash | 232 } // namespace ash |
| OLD | NEW |