| 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 29 matching lines...) Expand all Loading... |
| 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 WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() { | 49 WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() { |
| 50 ShellWindow* window = GetFirstShellWindow(); |
| 51 if (window) |
| 52 return window->web_contents(); |
| 53 |
| 54 return NULL; |
| 55 } |
| 56 |
| 57 ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() { |
| 50 ShellWindowRegistry* app_registry = | 58 ShellWindowRegistry* app_registry = |
| 51 ShellWindowRegistry::Get(browser()->profile()); | 59 ShellWindowRegistry::Get(browser()->profile()); |
| 52 ShellWindowRegistry::const_iterator iter; | 60 ShellWindowRegistry::const_iterator iter; |
| 53 ShellWindowRegistry::ShellWindowSet shell_windows = | 61 ShellWindowRegistry::ShellWindowSet shell_windows = |
| 54 app_registry->shell_windows(); | 62 app_registry->shell_windows(); |
| 55 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) { | 63 for (iter = shell_windows.begin(); iter != shell_windows.end(); ++iter) { |
| 56 return (*iter)->web_contents(); | 64 return *iter; |
| 57 } | 65 } |
| 58 | 66 |
| 59 return NULL; | 67 return NULL; |
| 60 } | 68 } |
| 61 | 69 |
| 62 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( | 70 size_t PlatformAppBrowserTest::RunGetWindowsFunctionForExtension( |
| 63 const Extension* extension) { | 71 const Extension* extension) { |
| 64 scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction(); | 72 scoped_refptr<GetAllWindowsFunction> function = new GetAllWindowsFunction(); |
| 65 function->set_extension(extension); | 73 function->set_extension(extension); |
| 66 scoped_ptr<base::ListValue> result(utils::ToList( | 74 scoped_ptr<base::ListValue> result(utils::ToList( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 122 |
| 115 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { | 123 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { |
| 116 content::WindowedNotificationObserver destroyed_observer( | 124 content::WindowedNotificationObserver destroyed_observer( |
| 117 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 125 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 118 content::NotificationService::AllSources()); | 126 content::NotificationService::AllSources()); |
| 119 window->GetBaseWindow()->Close(); | 127 window->GetBaseWindow()->Close(); |
| 120 destroyed_observer.Wait(); | 128 destroyed_observer.Wait(); |
| 121 } | 129 } |
| 122 | 130 |
| 123 } // namespace extensions | 131 } // namespace extensions |
| OLD | NEW |