Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: chrome/browser/apps/app_browsertest_util.cc

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 6
7 #include "apps/app_window_contents.h" 7 #include "apps/app_window_contents.h"
8 #include "apps/native_app_window.h" 8 #include "apps/native_app_window.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h"
not at google - send to devlin 2013/09/09 21:01:05 not used
sergeygs 2013/09/09 21:53:50 Done.
12 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 13 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
13 #include "chrome/browser/extensions/extension_function_test_utils.h" 14 #include "chrome/browser/extensions/extension_function_test_utils.h"
14 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" 15 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/extensions/application_launch.h" 17 #include "chrome/browser/ui/extensions/application_launch.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
19 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
20 #include "extensions/common/switches.h" 21 #include "extensions/common/switches.h"
21 22
22 using apps::ShellWindow; 23 using apps::ShellWindow;
23 using apps::ShellWindowRegistry; 24 using apps::ShellWindowRegistry;
24 using content::WebContents; 25 using content::WebContents;
26 using base::ASCIIToUTF16;
not at google - send to devlin 2013/09/09 21:01:05 not used
sergeygs 2013/09/09 21:53:50 Done.
25 27
26 namespace utils = extension_function_test_utils; 28 namespace utils = extension_function_test_utils;
27 29
28 namespace extensions { 30 namespace extensions {
29 31
30 PlatformAppBrowserTest::PlatformAppBrowserTest() { 32 PlatformAppBrowserTest::PlatformAppBrowserTest() {
31 ChromeShellWindowDelegate::DisableExternalOpenForTesting(); 33 ChromeShellWindowDelegate::DisableExternalOpenForTesting();
32 } 34 }
33 35
34 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { 36 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) {
(...skipping 18 matching lines...) Expand all
53 chrome::OpenApplication(chrome::AppLaunchParams(browser()->profile(), 55 chrome::OpenApplication(chrome::AppLaunchParams(browser()->profile(),
54 extension, 56 extension,
55 extension_misc::LAUNCH_NONE, 57 extension_misc::LAUNCH_NONE,
56 NEW_WINDOW)); 58 NEW_WINDOW));
57 59
58 app_loaded_observer.Wait(); 60 app_loaded_observer.Wait();
59 61
60 return extension; 62 return extension;
61 } 63 }
62 64
65 const Extension* PlatformAppBrowserTest::InstallPlatformApp(
66 const char* name) {
67 const Extension* extension = InstallExtension(
68 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name), 1);
69 EXPECT_TRUE(extension);
70
71 return extension;
72 }
73
63 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( 74 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp(
64 const char* name) { 75 const char* name) {
65 content::WindowedNotificationObserver app_loaded_observer( 76 content::WindowedNotificationObserver app_loaded_observer(
66 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 77 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
67 content::NotificationService::AllSources()); 78 content::NotificationService::AllSources());
68 79
69 const Extension* extension = InstallExtension( 80 const Extension* extension = InstallPlatformApp(name);
70 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name), 1);
71 EXPECT_TRUE(extension);
72 81
73 chrome::OpenApplication(chrome::AppLaunchParams(browser()->profile(), 82 chrome::OpenApplication(chrome::AppLaunchParams(browser()->profile(),
74 extension, 83 extension,
75 extension_misc::LAUNCH_NONE, 84 extension_misc::LAUNCH_NONE,
76 NEW_WINDOW)); 85 NEW_WINDOW));
77 86
78 app_loaded_observer.Wait(); 87 app_loaded_observer.Wait();
79 88
80 return extension; 89 return extension;
81 } 90 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bounds); 194 bounds);
186 } 195 }
187 196
188 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( 197 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine(
189 CommandLine* command_line) { 198 CommandLine* command_line) {
190 PlatformAppBrowserTest::SetUpCommandLine(command_line); 199 PlatformAppBrowserTest::SetUpCommandLine(command_line);
191 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 200 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
192 } 201 }
193 202
194 } // namespace extensions 203 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698