| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "content/public/browser/notification_service.h" | 6 #include "content/public/browser/notification_service.h" |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "content/public/test/test_utils.h" | 8 #include "content/public/test/test_utils.h" |
| 9 #include "extensions/browser/app_window/app_window.h" | 9 #include "extensions/browser/app_window/app_window.h" |
| 10 #include "extensions/browser/app_window/app_window_registry.h" | 10 #include "extensions/browser/app_window/app_window_registry.h" |
| 11 #include "extensions/browser/notification_types.h" | 11 #include "extensions/browser/notification_types.h" |
| 12 #include "extensions/shell/test/shell_apitest.h" | 12 #include "extensions/shell/test/shell_apitest.h" |
| 13 |
| 14 #if defined(USE_AURA) |
| 13 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #endif |
| 14 | 17 |
| 15 namespace extensions { | 18 namespace extensions { |
| 16 | 19 |
| 17 // Test that we can open an app window and wait for it to load. | 20 // Test that we can open an app window and wait for it to load. |
| 18 IN_PROC_BROWSER_TEST_F(ShellApiTest, Basic) { | 21 IN_PROC_BROWSER_TEST_F(ShellApiTest, Basic) { |
| 19 ASSERT_TRUE(RunAppTest("platform_app")) << message_; | 22 ASSERT_TRUE(RunAppTest("platform_app")) << message_; |
| 20 | 23 |
| 21 // A window was created. | 24 // A window was created. |
| 22 AppWindow* app_window = | 25 AppWindow* app_window = |
| 23 AppWindowRegistry::Get(browser_context())->app_windows().front(); | 26 AppWindowRegistry::Get(browser_context())->app_windows().front(); |
| 24 ASSERT_TRUE(app_window); | 27 ASSERT_TRUE(app_window); |
| 25 | 28 |
| 29 // TOOD(yoz): Test for focus on Cocoa. |
| 30 // app_window->GetBaseWindow()->IsActive() is possible, although on Mac, |
| 31 // focus changes are asynchronous, so interactive_ui_tests are required. |
| 32 #if defined(USE_AURA) |
| 26 // The web contents have focus. | 33 // The web contents have focus. |
| 27 EXPECT_TRUE(app_window->web_contents()->GetContentNativeView()->HasFocus()); | 34 EXPECT_TRUE(app_window->web_contents()->GetContentNativeView()->HasFocus()); |
| 35 #endif |
| 28 } | 36 } |
| 29 | 37 |
| 30 } // namespace extensions | 38 } // namespace extensions |
| OLD | NEW |