| 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/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 #include "content/public/test/browser_test_utils.h" | 7 #include "content/public/test/browser_test_utils.h" |
| 8 #include "extensions/browser/process_manager.h" | 8 #include "extensions/browser/process_manager.h" |
| 9 #include "extensions/common/switches.h" | 9 #include "extensions/common/switches.h" |
| 10 #include "extensions/test/extension_test_message_listener.h" | 10 #include "extensions/test/extension_test_message_listener.h" |
| 11 | 11 |
| 12 class WindowControlsTest : public extensions::PlatformAppBrowserTest { | 12 class WindowControlsTest : public extensions::PlatformAppBrowserTest { |
| 13 protected: | 13 protected: |
| 14 void SetUpCommandLine(CommandLine* command_line) override { | 14 void SetUpCommandLine(CommandLine* command_line) override { |
| 15 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); | 15 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 16 command_line->AppendSwitch(extensions::switches::kEnableAppWindowControls); | 16 command_line->AppendSwitch(extensions::switches::kEnableAppWindowControls); |
| 17 } | 17 } |
| 18 content::WebContents* GetWebContentsForExtensionWindow( | 18 content::WebContents* GetWebContentsForExtensionWindow( |
| 19 const extensions::Extension* extension); | 19 const extensions::Extension* extension); |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 content::WebContents* WindowControlsTest::GetWebContentsForExtensionWindow( | 22 content::WebContents* WindowControlsTest::GetWebContentsForExtensionWindow( |
| 23 const extensions::Extension* extension) { | 23 const extensions::Extension* extension) { |
| 24 extensions::ProcessManager* process_manager = | 24 extensions::ProcessManager* process_manager = |
| 25 extensions::ExtensionSystem::Get(profile())->process_manager(); | 25 extensions::ProcessManager::Get(profile()); |
| 26 | 26 |
| 27 // Lookup render view host for background page. | 27 // Lookup render view host for background page. |
| 28 const extensions::ExtensionHost* extension_host = | 28 const extensions::ExtensionHost* extension_host = |
| 29 process_manager->GetBackgroundHostForExtension(extension->id()); | 29 process_manager->GetBackgroundHostForExtension(extension->id()); |
| 30 content::RenderViewHost* background_view_host = | 30 content::RenderViewHost* background_view_host = |
| 31 extension_host->render_view_host(); | 31 extension_host->render_view_host(); |
| 32 | 32 |
| 33 // Go through all active views, looking for the first window of the extension | 33 // Go through all active views, looking for the first window of the extension |
| 34 const extensions::ProcessManager::ViewSet all_views = | 34 const extensions::ProcessManager::ViewSet all_views = |
| 35 process_manager->GetAllViews(); | 35 process_manager->GetAllViews(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const int controlOffset = 25; | 68 const int controlOffset = 25; |
| 69 int x = web_contents->GetContainerBounds().size().width() - controlOffset; | 69 int x = web_contents->GetContainerBounds().size().width() - controlOffset; |
| 70 int y = controlOffset; | 70 int y = controlOffset; |
| 71 content::SimulateMouseClickAt(web_contents, | 71 content::SimulateMouseClickAt(web_contents, |
| 72 0, | 72 0, |
| 73 blink::WebMouseEvent::ButtonLeft, | 73 blink::WebMouseEvent::ButtonLeft, |
| 74 gfx::Point(x, y)); | 74 gfx::Point(x, y)); |
| 75 | 75 |
| 76 ASSERT_TRUE(window_closed.WaitUntilSatisfied()); | 76 ASSERT_TRUE(window_closed.WaitUntilSatisfied()); |
| 77 } | 77 } |
| OLD | NEW |