OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/login/ui/login_feedback.h" | 5 #include "chrome/browser/chromeos/login/ui/login_feedback.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
11 #include "chrome/browser/chromeos/login/login_manager_test.h" | 12 #include "chrome/browser/chromeos/login/login_manager_test.h" |
12 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | 13 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
15 #include "extensions/browser/app_window/app_window.h" | 16 #include "extensions/browser/app_window/app_window.h" |
16 #include "extensions/browser/app_window/app_window_registry.h" | 17 #include "extensions/browser/app_window/app_window_registry.h" |
17 #include "extensions/browser/app_window/native_app_window.h" | 18 #include "extensions/browser/app_window/native_app_window.h" |
18 #include "ui/aura/client/focus_client.h" | 19 #include "ui/aura/client/focus_client.h" |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 class LoginFeedbackTest : public LoginManagerTest { | 23 class LoginFeedbackTest : public LoginManagerTest { |
23 public: | 24 public: |
24 LoginFeedbackTest() : LoginManagerTest(true) {} | 25 LoginFeedbackTest() : LoginManagerTest(true) {} |
25 ~LoginFeedbackTest() override {} | 26 ~LoginFeedbackTest() override {} |
26 | 27 |
27 private: | 28 private: |
28 DISALLOW_COPY_AND_ASSIGN(LoginFeedbackTest); | 29 DISALLOW_COPY_AND_ASSIGN(LoginFeedbackTest); |
29 }; | 30 }; |
30 | 31 |
31 // Test feedback UI shows up and is active. | 32 // Test feedback UI shows up and is active. |
32 IN_PROC_BROWSER_TEST_F(LoginFeedbackTest, Basic) { | 33 IN_PROC_BROWSER_TEST_F(LoginFeedbackTest, Basic) { |
33 Profile* const profile = ProfileHelper::GetSigninProfile(); | 34 Profile* const profile = ProfileHelper::GetSigninProfile(); |
34 scoped_ptr<LoginFeedback> login_feedback(new LoginFeedback(profile)); | 35 std::unique_ptr<LoginFeedback> login_feedback(new LoginFeedback(profile)); |
35 | 36 |
36 base::RunLoop run_loop; | 37 base::RunLoop run_loop; |
37 login_feedback->Request("Test feedback", run_loop.QuitClosure()); | 38 login_feedback->Request("Test feedback", run_loop.QuitClosure()); |
38 | 39 |
39 extensions::AppWindow* feedback_window = | 40 extensions::AppWindow* feedback_window = |
40 AppWindowWaiter(extensions::AppWindowRegistry::Get(profile), | 41 AppWindowWaiter(extensions::AppWindowRegistry::Get(profile), |
41 extension_misc::kFeedbackExtensionId) | 42 extension_misc::kFeedbackExtensionId) |
42 .WaitForShown(); | 43 .WaitForShown(); |
43 ASSERT_NE(nullptr, feedback_window); | 44 ASSERT_NE(nullptr, feedback_window); |
44 EXPECT_FALSE(feedback_window->is_hidden()); | 45 EXPECT_FALSE(feedback_window->is_hidden()); |
45 | 46 |
46 EXPECT_EQ(feedback_window->GetNativeWindow(), ash::wm::GetActiveWindow()); | 47 EXPECT_EQ(feedback_window->GetNativeWindow(), ash::wm::GetActiveWindow()); |
47 | 48 |
48 feedback_window->GetBaseWindow()->Close(); | 49 feedback_window->GetBaseWindow()->Close(); |
49 run_loop.Run(); | 50 run_loop.Run(); |
50 } | 51 } |
51 | 52 |
52 } // namespace chromeos | 53 } // namespace chromeos |
OLD | NEW |