| 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 14 matching lines...) Expand all Loading... |
| 25 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { | 25 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
| 26 // Skips ExtensionApiTest::SetUpCommandLine. | 26 // Skips ExtensionApiTest::SetUpCommandLine. |
| 27 ExtensionBrowserTest::SetUpCommandLine(command_line); | 27 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 28 | 28 |
| 29 // Make event pages get suspended quicker. | 29 // Make event pages get suspended quicker. |
| 30 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); | 30 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); |
| 31 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); | 31 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); |
| 32 } | 32 } |
| 33 | 33 |
| 34 const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp( | 34 const Extension* PlatformAppBrowserTest::LoadAndLaunchPlatformApp( |
| 35 const char* name) { | 35 Browser* browser, NotificationObserver* observer, |
| 36 FilePath test_data_dir, const char* name) { |
| 36 content::WindowedNotificationObserver app_loaded_observer( | 37 content::WindowedNotificationObserver app_loaded_observer( |
| 37 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 38 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 38 content::NotificationService::AllSources()); | 39 content::NotificationService::AllSources()); |
| 39 | 40 |
| 40 const Extension* extension = LoadExtension( | 41 const Extension* extension = LoadExtension( |
| 41 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name)); | 42 browser, observer, |
| 43 test_data_dir.AppendASCII("platform_apps").AppendASCII(name)); |
| 42 EXPECT_TRUE(extension); | 44 EXPECT_TRUE(extension); |
| 43 | 45 |
| 44 application_launch::OpenApplication(application_launch::LaunchParams( | 46 application_launch::OpenApplication(application_launch::LaunchParams( |
| 45 browser()->profile(), extension, extension_misc::LAUNCH_NONE, | 47 browser->profile(), extension, extension_misc::LAUNCH_NONE, |
| 46 NEW_WINDOW)); | 48 NEW_WINDOW)); |
| 47 | 49 |
| 48 app_loaded_observer.Wait(); | 50 app_loaded_observer.Wait(); |
| 49 | 51 |
| 50 return extension; | 52 return extension; |
| 51 } | 53 } |
| 52 | 54 |
| 53 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( | 55 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( |
| 54 const char* name) { | 56 const char* name) { |
| 55 content::WindowedNotificationObserver app_loaded_observer( | 57 content::WindowedNotificationObserver app_loaded_observer( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 147 |
| 146 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { | 148 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { |
| 147 content::WindowedNotificationObserver destroyed_observer( | 149 content::WindowedNotificationObserver destroyed_observer( |
| 148 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 150 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 149 content::NotificationService::AllSources()); | 151 content::NotificationService::AllSources()); |
| 150 window->GetBaseWindow()->Close(); | 152 window->GetBaseWindow()->Close(); |
| 151 destroyed_observer.Wait(); | 153 destroyed_observer.Wait(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace extensions | 156 } // namespace extensions |
| OLD | NEW |