| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/app_browsertest_util.h" | 5 #include "chrome/browser/apps/app_browsertest_util.h" |
| 6 #include "chrome/browser/extensions/extension_test_message_listener.h" | 6 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 7 #include "chrome/test/base/interactive_test_utils.h" | 7 #include "chrome/test/base/interactive_test_utils.h" |
| 8 #include "extensions/browser/app_window/native_app_window.h" | 8 #include "extensions/browser/app_window/native_app_window.h" |
| 9 | 9 |
| 10 #if defined(OS_MACOSX) && !defined(OS_IOS) | 10 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include <windows.h> | 15 #include <windows.h> |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_tree_host.h" | 17 #include "ui/aura/window_tree_host.h" |
| 18 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 18 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 19 #include "ui/views/win/hwnd_message_handler_delegate.h" | 19 #include "ui/views/win/hwnd_message_handler_delegate.h" |
| 20 #include "ui/views/win/hwnd_util.h" | 20 #include "ui/views/win/hwnd_util.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 using extensions::AppWindow; |
| 23 using extensions::NativeAppWindow; | 24 using extensions::NativeAppWindow; |
| 24 | 25 |
| 25 // Helper class that has to be created in the stack to check if the fullscreen | 26 // Helper class that has to be created in the stack to check if the fullscreen |
| 26 // setting of a NativeWindow has changed since the creation of the object. | 27 // setting of a NativeWindow has changed since the creation of the object. |
| 27 class FullscreenChangeWaiter { | 28 class FullscreenChangeWaiter { |
| 28 public: | 29 public: |
| 29 explicit FullscreenChangeWaiter(NativeAppWindow* window) | 30 explicit FullscreenChangeWaiter(NativeAppWindow* window) |
| 30 : window_(window), | 31 : window_(window), |
| 31 initial_fullscreen_state_(window_->IsFullscreen()) {} | 32 initial_fullscreen_state_(window_->IsFullscreen()) {} |
| 32 | 33 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 void AppWindowInteractiveTest::TestOuterBoundsHelper( | 356 void AppWindowInteractiveTest::TestOuterBoundsHelper( |
| 356 const std::string& frame_type) { | 357 const std::string& frame_type) { |
| 357 ExtensionTestMessageListener launched_listener("Launched", true); | 358 ExtensionTestMessageListener launched_listener("Launched", true); |
| 358 const extensions::Extension* app = | 359 const extensions::Extension* app = |
| 359 LoadAndLaunchPlatformApp("outer_bounds", &launched_listener); | 360 LoadAndLaunchPlatformApp("outer_bounds", &launched_listener); |
| 360 | 361 |
| 361 launched_listener.Reply(frame_type); | 362 launched_listener.Reply(frame_type); |
| 362 launched_listener.Reset(); | 363 launched_listener.Reset(); |
| 363 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 364 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 364 | 365 |
| 365 apps::AppWindow* window = GetFirstAppWindowForApp(app->id()); | 366 AppWindow* window = GetFirstAppWindowForApp(app->id()); |
| 366 gfx::Rect window_bounds; | 367 gfx::Rect window_bounds; |
| 367 gfx::Size min_size, max_size; | 368 gfx::Size min_size, max_size; |
| 368 | 369 |
| 369 #if defined(OS_WIN) | 370 #if defined(OS_WIN) |
| 370 // Get the bounds from the HWND. | 371 // Get the bounds from the HWND. |
| 371 HWND hwnd = views::HWNDForNativeWindow(window->GetNativeWindow()); | 372 HWND hwnd = views::HWNDForNativeWindow(window->GetNativeWindow()); |
| 372 RECT rect; | 373 RECT rect; |
| 373 ::GetWindowRect(hwnd, &rect); | 374 ::GetWindowRect(hwnd, &rect); |
| 374 window_bounds = gfx::Rect( | 375 window_bounds = gfx::Rect( |
| 375 rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); | 376 rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 ASSERT_TRUE(RunAppWindowInteractiveTest("testCreate")) << message_; | 449 ASSERT_TRUE(RunAppWindowInteractiveTest("testCreate")) << message_; |
| 449 } | 450 } |
| 450 | 451 |
| 451 IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, MAYBE_TestShow) { | 452 IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, MAYBE_TestShow) { |
| 452 ASSERT_TRUE(RunAppWindowInteractiveTest("testShow")) << message_; | 453 ASSERT_TRUE(RunAppWindowInteractiveTest("testShow")) << message_; |
| 453 } | 454 } |
| 454 | 455 |
| 455 IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, TestDrawAttention) { | 456 IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, TestDrawAttention) { |
| 456 ASSERT_TRUE(RunAppWindowInteractiveTest("testDrawAttention")) << message_; | 457 ASSERT_TRUE(RunAppWindowInteractiveTest("testDrawAttention")) << message_; |
| 457 } | 458 } |
| OLD | NEW |