| 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
| 6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
| 7 #include "apps/launcher.h" | 7 #include "apps/launcher.h" |
| 8 #include "apps/ui/native_app_window.h" | 8 #include "apps/ui/native_app_window.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 }; | 816 }; |
| 817 | 817 |
| 818 void PlatformAppDevToolsBrowserTest::RunTestWithDevTools( | 818 void PlatformAppDevToolsBrowserTest::RunTestWithDevTools( |
| 819 const char* name, int test_flags) { | 819 const char* name, int test_flags) { |
| 820 using content::DevToolsAgentHost; | 820 using content::DevToolsAgentHost; |
| 821 const Extension* extension = LoadAndLaunchPlatformApp(name, "Launched"); | 821 const Extension* extension = LoadAndLaunchPlatformApp(name, "Launched"); |
| 822 ASSERT_TRUE(extension); | 822 ASSERT_TRUE(extension); |
| 823 AppWindow* window = GetFirstAppWindow(); | 823 AppWindow* window = GetFirstAppWindow(); |
| 824 ASSERT_TRUE(window); | 824 ASSERT_TRUE(window); |
| 825 ASSERT_EQ(window->window_key().empty(), (test_flags & HAS_ID) == 0); | 825 ASSERT_EQ(window->window_key().empty(), (test_flags & HAS_ID) == 0); |
| 826 content::RenderViewHost* rvh = window->web_contents()->GetRenderViewHost(); | 826 content::WebContents* web_contents = window->web_contents(); |
| 827 ASSERT_TRUE(rvh); | 827 ASSERT_TRUE(web_contents); |
| 828 | 828 |
| 829 // Ensure no DevTools open for the AppWindow, then open one. | 829 // Ensure no DevTools open for the AppWindow, then open one. |
| 830 ASSERT_FALSE(DevToolsAgentHost::HasFor(rvh)); | 830 ASSERT_FALSE(DevToolsAgentHost::HasFor(web_contents)); |
| 831 DevToolsWindow::OpenDevToolsWindow(rvh); | 831 DevToolsWindow::OpenDevToolsWindow(web_contents); |
| 832 ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh)); | 832 ASSERT_TRUE(DevToolsAgentHost::HasFor(web_contents)); |
| 833 | 833 |
| 834 if (test_flags & RELAUNCH) { | 834 if (test_flags & RELAUNCH) { |
| 835 // Close the AppWindow, and ensure it is gone. | 835 // Close the AppWindow, and ensure it is gone. |
| 836 CloseAppWindow(window); | 836 CloseAppWindow(window); |
| 837 ASSERT_FALSE(GetFirstAppWindow()); | 837 ASSERT_FALSE(GetFirstAppWindow()); |
| 838 | 838 |
| 839 // Relaunch the app and get a new AppWindow. | 839 // Relaunch the app and get a new AppWindow. |
| 840 content::WindowedNotificationObserver app_loaded_observer( | 840 content::WindowedNotificationObserver app_loaded_observer( |
| 841 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 841 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 842 content::NotificationService::AllSources()); | 842 content::NotificationService::AllSources()); |
| 843 OpenApplication(AppLaunchParams( | 843 OpenApplication(AppLaunchParams( |
| 844 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 844 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); |
| 845 app_loaded_observer.Wait(); | 845 app_loaded_observer.Wait(); |
| 846 window = GetFirstAppWindow(); | 846 window = GetFirstAppWindow(); |
| 847 ASSERT_TRUE(window); | 847 ASSERT_TRUE(window); |
| 848 | 848 |
| 849 // DevTools should have reopened with the relaunch. | 849 // DevTools should have reopened with the relaunch. |
| 850 rvh = window->web_contents()->GetRenderViewHost(); | 850 web_contents = window->web_contents(); |
| 851 ASSERT_TRUE(rvh); | 851 ASSERT_TRUE(web_contents); |
| 852 ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh)); | 852 ASSERT_TRUE(DevToolsAgentHost::HasFor(web_contents)); |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 } // namespace | 856 } // namespace |
| 857 | 857 |
| 858 // http://crbug.com/246634 | 858 // http://crbug.com/246634 |
| 859 #if defined(OS_CHROMEOS) | 859 #if defined(OS_CHROMEOS) |
| 860 #define MAYBE_ReOpenedWithID DISABLED_ReOpenedWithID | 860 #define MAYBE_ReOpenedWithID DISABLED_ReOpenedWithID |
| 861 #else | 861 #else |
| 862 #define MAYBE_ReOpenedWithID ReOpenedWithID | 862 #define MAYBE_ReOpenedWithID ReOpenedWithID |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); | 1284 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); |
| 1285 ASSERT_TRUE(extension); | 1285 ASSERT_TRUE(extension); |
| 1286 ASSERT_EQ(extension_id, extension->id()); | 1286 ASSERT_EQ(extension_id, extension->id()); |
| 1287 | 1287 |
| 1288 ExtensionApiTest::ResultCatcher result_catcher; | 1288 ExtensionApiTest::ResultCatcher result_catcher; |
| 1289 EXPECT_TRUE(result_catcher.GetNextResult()); | 1289 EXPECT_TRUE(result_catcher.GetNextResult()); |
| 1290 } | 1290 } |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 } // namespace extensions | 1293 } // namespace extensions |
| OLD | NEW |