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