| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/platform_app_browsertest_util.h" | 5 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/tabs/tabs.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs.h" |
| 10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 application_launch::OpenApplication(application_launch::LaunchParams( | 40 application_launch::OpenApplication(application_launch::LaunchParams( |
| 41 browser()->profile(), extension, extension_misc::LAUNCH_NONE, | 41 browser()->profile(), extension, extension_misc::LAUNCH_NONE, |
| 42 NEW_WINDOW)); | 42 NEW_WINDOW)); |
| 43 | 43 |
| 44 app_loaded_observer.Wait(); | 44 app_loaded_observer.Wait(); |
| 45 | 45 |
| 46 return extension; | 46 return extension; |
| 47 } | 47 } |
| 48 | 48 |
| 49 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( |
| 50 const char* name) { |
| 51 content::WindowedNotificationObserver app_loaded_observer( |
| 52 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 53 content::NotificationService::AllSources()); |
| 54 |
| 55 const Extension* extension = InstallExtension( |
| 56 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name), 1); |
| 57 EXPECT_TRUE(extension); |
| 58 |
| 59 application_launch::OpenApplication(application_launch::LaunchParams( |
| 60 browser()->profile(), extension, extension_misc::LAUNCH_NONE, |
| 61 NEW_WINDOW)); |
| 62 |
| 63 app_loaded_observer.Wait(); |
| 64 |
| 65 return extension; |
| 66 } |
| 67 |
| 49 WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() { | 68 WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() { |
| 50 ShellWindow* window = GetFirstShellWindow(); | 69 ShellWindow* window = GetFirstShellWindow(); |
| 51 if (window) | 70 if (window) |
| 52 return window->web_contents(); | 71 return window->web_contents(); |
| 53 | 72 |
| 54 return NULL; | 73 return NULL; |
| 55 } | 74 } |
| 56 | 75 |
| 57 ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() { | 76 ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() { |
| 58 ShellWindowRegistry* app_registry = | 77 ShellWindowRegistry* app_registry = |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 141 |
| 123 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { | 142 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { |
| 124 content::WindowedNotificationObserver destroyed_observer( | 143 content::WindowedNotificationObserver destroyed_observer( |
| 125 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 144 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 126 content::NotificationService::AllSources()); | 145 content::NotificationService::AllSources()); |
| 127 window->GetBaseWindow()->Close(); | 146 window->GetBaseWindow()->Close(); |
| 128 destroyed_observer.Wait(); | 147 destroyed_observer.Wait(); |
| 129 } | 148 } |
| 130 | 149 |
| 131 } // namespace extensions | 150 } // namespace extensions |
| OLD | NEW |