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/signin/signin_error_notifier_ash.h" | 5 #include "chrome/browser/signin/signin_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 "components/signin/core/browser/fake_auth_status_provider.h" | 24 #include "components/signin/core/browser/fake_auth_status_provider.h" |
25 #include "components/signin/core/browser/signin_error_controller.h" | 25 #include "components/signin/core/browser/signin_error_controller.h" |
26 #include "components/signin/core/browser/signin_manager.h" | 26 #include "components/signin/core/browser/signin_manager.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 27 #include "content/public/test/test_browser_thread_bundle.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 namespace ash { | 37 namespace ash { |
38 namespace test { | 38 namespace test { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 static const char kTestAccountId[] = "testuser@test.com"; | 42 static const char kTestAccountId[] = "testuser@test.com"; |
43 | 43 |
44 // Notification ID corresponding to kProfileSigninNotificationId + | 44 // Notification ID corresponding to kProfileSigninNotificationId + |
(...skipping 15 matching lines...) Expand all Loading... |
60 profile_manager_.reset( | 60 profile_manager_.reset( |
61 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 61 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
62 ASSERT_TRUE(profile_manager_->SetUp()); | 62 ASSERT_TRUE(profile_manager_->SetUp()); |
63 | 63 |
64 TestingBrowserProcess::GetGlobal(); | 64 TestingBrowserProcess::GetGlobal(); |
65 AshTestBase::SetUp(); | 65 AshTestBase::SetUp(); |
66 | 66 |
67 // Set up screen for Windows. | 67 // Set up screen for Windows. |
68 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
69 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); | 69 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); |
70 gfx::Screen::SetScreenInstance(test_screen_.get()); | 70 display::Screen::SetScreenInstance(test_screen_.get()); |
71 #endif | 71 #endif |
72 | 72 |
73 error_controller_ = SigninErrorControllerFactory::GetForProfile( | 73 error_controller_ = SigninErrorControllerFactory::GetForProfile( |
74 profile_.get()); | 74 profile_.get()); |
75 SigninErrorNotifierFactory::GetForProfile(profile_.get()); | 75 SigninErrorNotifierFactory::GetForProfile(profile_.get()); |
76 notification_ui_manager_ = g_browser_process->notification_ui_manager(); | 76 notification_ui_manager_ = g_browser_process->notification_ui_manager(); |
77 } | 77 } |
78 | 78 |
79 void TearDown() override { | 79 void TearDown() override { |
80 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
81 gfx::Screen::SetScreenInstance(nullptr); | 81 display::Screen::SetScreenInstance(nullptr); |
82 test_screen_.reset(); | 82 test_screen_.reset(); |
83 #endif | 83 #endif |
84 profile_manager_.reset(); | 84 profile_manager_.reset(); |
85 | 85 |
86 AshTestBase::TearDown(); | 86 AshTestBase::TearDown(); |
87 } | 87 } |
88 | 88 |
89 protected: | 89 protected: |
90 void GetMessage(base::string16* message) { | 90 void GetMessage(base::string16* message) { |
91 const Notification* notification = | 91 const Notification* notification = |
92 g_browser_process->notification_ui_manager()->FindById( | 92 g_browser_process->notification_ui_manager()->FindById( |
93 kNotificationId, | 93 kNotificationId, |
94 NotificationUIManager::GetProfileID(profile_.get())); | 94 NotificationUIManager::GetProfileID(profile_.get())); |
95 ASSERT_FALSE(notification == NULL); | 95 ASSERT_FALSE(notification == NULL); |
96 *message = notification->message(); | 96 *message = notification->message(); |
97 } | 97 } |
98 | 98 |
99 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
100 std::unique_ptr<gfx::Screen> test_screen_; | 100 std::unique_ptr<display::Screen> test_screen_; |
101 #endif | 101 #endif |
102 std::unique_ptr<TestingProfileManager> profile_manager_; | 102 std::unique_ptr<TestingProfileManager> profile_manager_; |
103 std::unique_ptr<TestingProfile> profile_; | 103 std::unique_ptr<TestingProfile> profile_; |
104 SigninErrorController* error_controller_; | 104 SigninErrorController* error_controller_; |
105 NotificationUIManager* notification_ui_manager_; | 105 NotificationUIManager* notification_ui_manager_; |
106 }; | 106 }; |
107 | 107 |
108 TEST_F(SigninErrorNotifierTest, NoErrorAuthStatusProviders) { | 108 TEST_F(SigninErrorNotifierTest, NoErrorAuthStatusProviders) { |
109 ASSERT_FALSE(notification_ui_manager_->FindById( | 109 ASSERT_FALSE(notification_ui_manager_->FindById( |
110 kNotificationId, NotificationUIManager::GetProfileID(profile_.get()))); | 110 kNotificationId, NotificationUIManager::GetProfileID(profile_.get()))); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 EXPECT_FALSE(notification->title().empty()); | 232 EXPECT_FALSE(notification->title().empty()); |
233 EXPECT_FALSE(notification->message().empty()); | 233 EXPECT_FALSE(notification->message().empty()); |
234 EXPECT_EQ((size_t)1, notification->buttons().size()); | 234 EXPECT_EQ((size_t)1, notification->buttons().size()); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 #endif | 238 #endif |
239 | 239 |
240 } // namespace test | 240 } // namespace test |
241 } // namespace ash | 241 } // namespace ash |
OLD | NEW |