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> | 9 #include <memory> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
25 #include "components/browser_sync/browser/profile_sync_service_mock.h" | 25 #include "components/browser_sync/browser/profile_sync_service_mock.h" |
26 #include "components/sync_driver/sync_error_controller.h" | 26 #include "components/sync_driver/sync_error_controller.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "ui/message_center/notification.h" | 29 #include "ui/message_center/notification.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "chrome/browser/ui/ash/ash_util.h" | 32 #include "chrome/browser/ui/ash/ash_util.h" |
33 #include "ui/aura/test/test_screen.h" | 33 #include "ui/aura/test/test_screen.h" |
34 #include "ui/gfx/screen.h" | 34 #include "ui/display/screen.h" |
35 #endif | 35 #endif |
36 | 36 |
37 using ::testing::NiceMock; | 37 using ::testing::NiceMock; |
38 using ::testing::Return; | 38 using ::testing::Return; |
39 using ::testing::ReturnRef; | 39 using ::testing::ReturnRef; |
40 using ::testing::_; | 40 using ::testing::_; |
41 | 41 |
42 namespace ash { | 42 namespace ash { |
43 namespace test { | 43 namespace test { |
44 | 44 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 SyncErrorNotifierTest() {} | 82 SyncErrorNotifierTest() {} |
83 ~SyncErrorNotifierTest() override {} | 83 ~SyncErrorNotifierTest() override {} |
84 | 84 |
85 void SetUp() override { | 85 void SetUp() override { |
86 DCHECK(TestingBrowserProcess::GetGlobal()); | 86 DCHECK(TestingBrowserProcess::GetGlobal()); |
87 | 87 |
88 // Set up a desktop screen for Windows to hold native widgets, used when | 88 // Set up a desktop screen for Windows to hold native widgets, used when |
89 // adding desktop widgets (i.e., message center notifications). | 89 // adding desktop widgets (i.e., message center notifications). |
90 #if defined(OS_WIN) | 90 #if defined(OS_WIN) |
91 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); | 91 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); |
92 gfx::Screen::SetScreenInstance(test_screen_.get()); | 92 display::Screen::SetScreenInstance(test_screen_.get()); |
93 #endif | 93 #endif |
94 | 94 |
95 AshTestBase::SetUp(); | 95 AshTestBase::SetUp(); |
96 | 96 |
97 profile_manager_.reset( | 97 profile_manager_.reset( |
98 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 98 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
99 ASSERT_TRUE(profile_manager_->SetUp()); | 99 ASSERT_TRUE(profile_manager_->SetUp()); |
100 | 100 |
101 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); | 101 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); |
102 | 102 |
(...skipping 13 matching lines...) Expand all Loading... |
116 } | 116 } |
117 | 117 |
118 void TearDown() override { | 118 void TearDown() override { |
119 error_notifier_->Shutdown(); | 119 error_notifier_->Shutdown(); |
120 service_.reset(); | 120 service_.reset(); |
121 profile_manager_.reset(); | 121 profile_manager_.reset(); |
122 | 122 |
123 AshTestBase::TearDown(); | 123 AshTestBase::TearDown(); |
124 | 124 |
125 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
126 gfx::Screen::SetScreenInstance(nullptr); | 126 display::Screen::SetScreenInstance(nullptr); |
127 test_screen_.reset(); | 127 test_screen_.reset(); |
128 #endif | 128 #endif |
129 | 129 |
130 } | 130 } |
131 | 131 |
132 protected: | 132 protected: |
133 // Utility function to test that SyncErrorNotifier behaves correctly for the | 133 // Utility function to test that SyncErrorNotifier behaves correctly for the |
134 // given error condition. | 134 // given error condition. |
135 void VerifySyncErrorNotifierResult(GoogleServiceAuthError::State error_state, | 135 void VerifySyncErrorNotifierResult(GoogleServiceAuthError::State error_state, |
136 bool is_signed_in, | 136 bool is_signed_in, |
(...skipping 15 matching lines...) Expand all Loading... |
152 ASSERT_TRUE(notification); | 152 ASSERT_TRUE(notification); |
153 ASSERT_FALSE(notification->title().empty()); | 153 ASSERT_FALSE(notification->title().empty()); |
154 ASSERT_FALSE(notification->title().empty()); | 154 ASSERT_FALSE(notification->title().empty()); |
155 ASSERT_EQ((size_t)1, notification->buttons().size()); | 155 ASSERT_EQ((size_t)1, notification->buttons().size()); |
156 } else { | 156 } else { |
157 ASSERT_FALSE(notification); | 157 ASSERT_FALSE(notification); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
162 std::unique_ptr<gfx::Screen> test_screen_; | 162 std::unique_ptr<display::Screen> test_screen_; |
163 #endif | 163 #endif |
164 std::unique_ptr<TestingProfileManager> profile_manager_; | 164 std::unique_ptr<TestingProfileManager> profile_manager_; |
165 std::unique_ptr<SyncErrorController> error_controller_; | 165 std::unique_ptr<SyncErrorController> error_controller_; |
166 std::unique_ptr<SyncErrorNotifier> error_notifier_; | 166 std::unique_ptr<SyncErrorNotifier> error_notifier_; |
167 std::unique_ptr<ProfileSyncServiceMock> service_; | 167 std::unique_ptr<ProfileSyncServiceMock> service_; |
168 TestingProfile* profile_; | 168 TestingProfile* profile_; |
169 FakeLoginUI login_ui_; | 169 FakeLoginUI login_ui_; |
170 NotificationUIManager* notification_ui_manager_; | 170 NotificationUIManager* notification_ui_manager_; |
171 | 171 |
172 private: | 172 private: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); | 223 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); |
224 VerifySyncErrorNotifierResult( | 224 VerifySyncErrorNotifierResult( |
225 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 225 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
226 false /* not signed in */, | 226 false /* not signed in */, |
227 false /* no error */); | 227 false /* no error */); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 } // namespace test | 231 } // namespace test |
232 } // namespace ash | 232 } // namespace ash |
OLD | NEW |