blob: df84214388380c9c6f06d593a855986256fa0d30 [file] [log] [blame]
[email protected]a44657202012-01-09 05:48:311// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]cfc6cca2011-12-01 02:30:062// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]b3c019b2012-08-28 02:43:485#include "base/utf_string_conversions.h"
[email protected]ad687a72012-06-08 06:03:116#include "chrome/app/chrome_command_ids.h"
[email protected]605fb8102012-05-04 01:36:557#include "chrome/browser/automation/automation_util.h"
[email protected]375003a2011-12-13 02:53:218#include "chrome/browser/tab_contents/render_view_context_menu.h"
[email protected]259771102012-05-31 16:52:209#include "chrome/browser/extensions/extension_test_message_listener.h"
10#include "chrome/browser/extensions/platform_app_browsertest_util.h"
11#include "chrome/browser/extensions/shell_window_registry.h"
[email protected]cfc6cca2011-12-01 02:30:0612#include "chrome/browser/ui/browser.h"
[email protected]52877dbc62012-06-29 22:22:0313#include "chrome/browser/ui/browser_tabstrip.h"
[email protected]a5a0be02012-07-18 05:51:5414#include "chrome/browser/ui/extensions/application_launch.h"
[email protected]d72d3a62012-05-10 03:45:0815#include "chrome/browser/ui/extensions/shell_window.h"
[email protected]5b1a04b42012-06-15 00:41:4416#include "chrome/common/chrome_notification_types.h"
[email protected]cfc6cca2011-12-01 02:30:0617#include "chrome/test/base/ui_test_utils.h"
[email protected]fb29e6cf2012-07-12 21:27:2018#include "content/public/browser/render_process_host.h"
[email protected]cfc6cca2011-12-01 02:30:0619
[email protected]bb81f382012-01-03 22:45:4420using content::WebContents;
[email protected]d9ede582012-08-14 19:21:3821
22namespace extensions {
[email protected]31bdbfef2012-05-22 19:59:1523
[email protected]375003a2011-12-13 02:53:2124namespace {
25// Non-abstract RenderViewContextMenu class.
26class PlatformAppContextMenu : public RenderViewContextMenu {
27 public:
[email protected]bb81f382012-01-03 22:45:4428 PlatformAppContextMenu(WebContents* web_contents,
[email protected]35be7ec2012-02-12 20:42:5129 const content::ContextMenuParams& params)
[email protected]bb81f382012-01-03 22:45:4430 : RenderViewContextMenu(web_contents, params) {}
[email protected]375003a2011-12-13 02:53:2131
[email protected]ad687a72012-06-08 06:03:1132 bool HasCommandWithId(int command_id) {
33 return menu_model_.GetIndexOfCommandId(command_id) != -1;
34 }
35
[email protected]375003a2011-12-13 02:53:2136 protected:
37 // These two functions implement pure virtual methods of
38 // RenderViewContextMenu.
39 virtual bool GetAcceleratorForCommandId(int command_id,
40 ui::Accelerator* accelerator) {
41 return false;
42 }
43 virtual void PlatformInit() {}
[email protected]f5d5cd02012-05-04 13:59:3044 virtual void PlatformCancel() {}
[email protected]375003a2011-12-13 02:53:2145};
46
47} // namespace
48
[email protected]eb4bcac2012-06-27 01:32:0849// Tests that CreateShellWindow doesn't crash if you close it straight away.
50// LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for
51// ash, so we test that it works here.
52IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseShellWindow) {
53 const Extension* extension = LoadAndLaunchPlatformApp("minimal");
54 ShellWindow* window = CreateShellWindow(extension);
55 CloseShellWindow(window);
56}
57
[email protected]dc37b002012-04-23 23:02:2658// Tests that platform apps received the "launch" event when launched.
59IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) {
60 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch")) << message_;
[email protected]cfc6cca2011-12-01 02:30:0661}
[email protected]375003a2011-12-13 02:53:2162
[email protected]567230b2012-08-21 21:11:4463// Tests that platform apps cannot use certain disabled window properties, but
64// can override them and then use them.
65IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisabledWindowProperties) {
66 ASSERT_TRUE(RunPlatformAppTest("platform_apps/disabled_window_properties"))
67 << message_;
68}
69
[email protected]edd7ed692012-02-08 02:50:0370IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
[email protected]dc37b002012-04-23 23:02:2671 ExtensionTestMessageListener launched_listener("Launched", false);
[email protected]31bdbfef2012-05-22 19:59:1572 LoadAndLaunchPlatformApp("minimal");
[email protected]dc37b002012-04-23 23:02:2673
74 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
[email protected]375003a2011-12-13 02:53:2175
[email protected]375003a2011-12-13 02:53:2176 // The empty app doesn't add any context menu items, so its menu should
[email protected]0cfacd82012-02-09 01:55:3377 // only include the developer tools.
[email protected]d72d3a62012-05-10 03:45:0878 WebContents* web_contents = GetFirstShellWindowWebContents();
[email protected]a44657202012-01-09 05:48:3179 ASSERT_TRUE(web_contents);
[email protected]375003a2011-12-13 02:53:2180 WebKit::WebContextMenuData data;
[email protected]35be7ec2012-02-12 20:42:5181 content::ContextMenuParams params(data);
[email protected]bb81f382012-01-03 22:45:4482 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
[email protected]375003a2011-12-13 02:53:2183 params);
84 menu->Init();
[email protected]ad687a72012-06-08 06:03:1185 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
86 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
87 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
88 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
[email protected]375003a2011-12-13 02:53:2189}
90
[email protected]edd7ed692012-02-08 02:50:0391IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
[email protected]dc37b002012-04-23 23:02:2692 ExtensionTestMessageListener launched_listener("Launched", false);
[email protected]375003a2011-12-13 02:53:2193 LoadAndLaunchPlatformApp("context_menu");
94
[email protected]dc37b002012-04-23 23:02:2695 // Wait for the extension to tell us it's initialized its context menus and
96 // launched a window.
97 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
[email protected]375003a2011-12-13 02:53:2198
[email protected]271d01c2012-08-27 23:48:0599 // The context_menu app has two context menu items. These, along with a
[email protected]0cfacd82012-02-09 01:55:33100 // separator and the developer tools, is all that should be in the menu.
[email protected]d72d3a62012-05-10 03:45:08101 WebContents* web_contents = GetFirstShellWindowWebContents();
[email protected]a44657202012-01-09 05:48:31102 ASSERT_TRUE(web_contents);
[email protected]375003a2011-12-13 02:53:21103 WebKit::WebContextMenuData data;
[email protected]35be7ec2012-02-12 20:42:51104 content::ContextMenuParams params(data);
[email protected]bb81f382012-01-03 22:45:44105 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
[email protected]375003a2011-12-13 02:53:21106 params);
107 menu->Init();
[email protected]ad687a72012-06-08 06:03:11108 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
[email protected]271d01c2012-08-27 23:48:05109 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST + 1));
[email protected]ad687a72012-06-08 06:03:11110 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
111 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
112 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
113 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
[email protected]b3c019b2012-08-28 02:43:48114 ASSERT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
115}
116
117IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
118 ExtensionTestMessageListener launched_listener("Launched", false);
119 LoadAndLaunchPlatformApp("context_menu");
120
121 // Wait for the extension to tell us it's initialized its context menus and
122 // launched a window.
123 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
124
125 // The context_menu app has one context menu item. This, along with a
126 // separator and the developer tools, is all that should be in the menu.
127 WebContents* web_contents = GetFirstShellWindowWebContents();
128 ASSERT_TRUE(web_contents);
129 WebKit::WebContextMenuData data;
130 content::ContextMenuParams params(data);
131 params.is_editable = true;
132 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
133 params);
134 menu->Init();
135 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
136 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
137 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
138 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
139 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPY));
140 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
141 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
142}
143
144IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) {
145 ExtensionTestMessageListener launched_listener("Launched", false);
146 LoadAndLaunchPlatformApp("context_menu");
147
148 // Wait for the extension to tell us it's initialized its context menus and
149 // launched a window.
150 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
151
152 // The context_menu app has one context menu item. This, along with a
153 // separator and the developer tools, is all that should be in the menu.
154 WebContents* web_contents = GetFirstShellWindowWebContents();
155 ASSERT_TRUE(web_contents);
156 WebKit::WebContextMenuData data;
157 content::ContextMenuParams params(data);
158 params.selection_text = ASCIIToUTF16("Hello World");
159 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
160 params);
161 menu->Init();
162 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
163 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
164 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
165 ASSERT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
166 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPY));
167 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
168 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
[email protected]375003a2011-12-13 02:53:21169}
[email protected]5f000f272012-01-19 05:25:08170
[email protected]dc83c582012-08-17 02:18:14171IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {
172 ExtensionTestMessageListener launched_listener("Launched", false);
173 LoadAndLaunchPlatformApp("context_menu_click");
174
175 // Wait for the extension to tell us it's initialized its context menus and
176 // launched a window.
177 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
178
179 // Test that the menu item shows up
180 WebContents* web_contents = GetFirstShellWindowWebContents();
181 ASSERT_TRUE(web_contents);
182 WebKit::WebContextMenuData data;
183 content::ContextMenuParams params(data);
184 params.page_url = GURL("http://foo.bar");
185 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
186 params);
187 menu->Init();
188 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
189
190 // Execute the menu item
191 ExtensionTestMessageListener onclicked_listener("onClicked fired for id1",
192 false);
193 menu->ExecuteCommand(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST);
194
195 ASSERT_TRUE(onclicked_listener.WaitUntilSatisfied());
196}
197
[email protected]edd7ed692012-02-08 02:50:03198IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) {
[email protected]dc37b002012-04-23 23:02:26199 ASSERT_TRUE(StartTestServer());
200 ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_;
[email protected]5f000f272012-01-19 05:25:08201}
[email protected]863e6472012-01-24 19:33:58202
[email protected]fd3238af2012-05-22 18:55:30203IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Iframes) {
204 ASSERT_TRUE(StartTestServer());
205 ASSERT_TRUE(RunPlatformAppTest("platform_apps/iframes")) << message_;
206}
207
[email protected]2aac7ff2012-01-25 18:05:11208// Tests that localStorage and WebSQL are disabled for platform apps.
[email protected]edd7ed692012-02-08 02:50:03209IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowStorage) {
[email protected]2aac7ff2012-01-25 18:05:11210 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_;
211}
[email protected]6a5a2e52012-03-22 03:21:12212
[email protected]c0cecd1f2012-04-05 16:50:12213IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Restrictions) {
214 ASSERT_TRUE(RunPlatformAppTest("platform_apps/restrictions")) << message_;
215}
216
[email protected]f0233ff2012-07-20 20:14:50217// Tests that platform apps can use the chrome.app.window.* API.
[email protected]dc37b002012-04-23 23:02:26218IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApi) {
[email protected]6a5a2e52012-03-22 03:21:12219 ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_;
220}
[email protected]605fb8102012-05-04 01:36:55221
222// Tests that platform apps have isolated storage by default.
223IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Isolation) {
224 ASSERT_TRUE(StartTestServer());
225
226 // Load a (non-app) page under the "localhost" origin that sets a cookie.
227 GURL set_cookie_url = test_server()->GetURL(
228 "files/extensions/platform_apps/isolation/set_cookie.html");
229 GURL::Replacements replace_host;
230 std::string host_str("localhost"); // Must stay in scope with replace_host.
231 replace_host.SetHostStr(host_str);
232 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host);
233
234 ui_test_utils::NavigateToURLWithDisposition(
235 browser(), set_cookie_url,
236 CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
237
238 // Make sure the cookie is set.
239 int cookie_size;
240 std::string cookie_value;
241 automation_util::GetCookies(
242 set_cookie_url,
[email protected]52877dbc62012-06-29 22:22:03243 chrome::GetWebContentsAt(browser(), 0),
[email protected]605fb8102012-05-04 01:36:55244 &cookie_size,
245 &cookie_value);
246 ASSERT_EQ("testCookie=1", cookie_value);
247
248 // Let the platform app request the same URL, and make sure that it doesn't
249 // see the cookie.
250 ASSERT_TRUE(RunPlatformAppTest("platform_apps/isolation")) << message_;
251}
[email protected]31bdbfef2012-05-22 19:59:15252
253IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ExtensionWindowingApis) {
254 // Initially there should be just the one browser window visible to the
255 // extensions API.
256 const Extension* extension = LoadExtension(
257 test_data_dir_.AppendASCII("common/background_page"));
258 ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension));
259
260 // And no shell windows.
261 ASSERT_EQ(0U, GetShellWindowCount());
262
263 // Launch a platform app that shows a window.
264 ExtensionTestMessageListener launched_listener("Launched", false);
[email protected]ad5bb8a92012-06-07 03:55:58265 LoadAndLaunchPlatformApp("minimal");
[email protected]31bdbfef2012-05-22 19:59:15266 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
267 ASSERT_EQ(1U, GetShellWindowCount());
268 ShellWindowRegistry::ShellWindowSet shell_windows =
269 ShellWindowRegistry::Get(browser()->profile())->shell_windows();
270 int shell_window_id = (*shell_windows.begin())->session_id().id();
271
272 // But it's not visible to the extensions API, it still thinks there's just
273 // one browser window.
274 ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension));
275 // It can't look it up by ID either
276 ASSERT_FALSE(RunGetWindowFunctionForExtension(shell_window_id, extension));
277
278 // The app can also only see one window (its own).
[email protected]ad5bb8a92012-06-07 03:55:58279 // TODO(jeremya): add an extension function to get a shell window by ID, and
280 // to get a list of all the shell windows, so we can test this.
[email protected]31bdbfef2012-05-22 19:59:15281
282 // Launch another platform app that also shows a window.
283 ExtensionTestMessageListener launched_listener2("Launched", false);
[email protected]ad5bb8a92012-06-07 03:55:58284 LoadAndLaunchPlatformApp("context_menu");
[email protected]31bdbfef2012-05-22 19:59:15285 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
286
287 // There are two total shell windows, but each app can only see its own.
288 ASSERT_EQ(2U, GetShellWindowCount());
[email protected]ad5bb8a92012-06-07 03:55:58289 // TODO(jeremya): as above, this requires more extension functions.
[email protected]31bdbfef2012-05-22 19:59:15290}
[email protected]12e540452012-05-26 07:09:36291
292// TODO(benwells): fix these tests for ChromeOS.
293#if !defined(OS_CHROMEOS)
294// Tests that command line parameters get passed through to platform apps
295// via launchData correctly when launching with a file.
296IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithFile) {
297 SetCommandLineArg( "platform_apps/launch_files/test.txt");
298 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_file"))
299 << message_;
300}
301
[email protected]a5a0be02012-07-18 05:51:54302// Tests that relative paths can be passed through to the platform app.
303// This test doesn't use the normal test infrastructure as it needs to open
304// the application differently to all other platform app tests, by setting
305// the application_launch::LaunchParams.current_directory field.
306IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithRelativeFile) {
307 // Setup the command line
308 ClearCommandLineArgs();
309 CommandLine* command_line = CommandLine::ForCurrentProcess();
310 FilePath relative_test_doc = FilePath::FromUTF8Unsafe(
311 "platform_apps/launch_files/test.txt");
312 relative_test_doc = relative_test_doc.NormalizePathSeparators();
313 command_line->AppendArgPath(relative_test_doc);
314
315 // Load the extension
316 ResultCatcher catcher;
[email protected]d9ede582012-08-14 19:21:38317 const Extension* extension = LoadExtension(
[email protected]a5a0be02012-07-18 05:51:54318 test_data_dir_.AppendASCII("platform_apps/launch_file"));
319 ASSERT_TRUE(extension);
320
321 // Run the test
322 application_launch::LaunchParams params(browser()->profile(), extension,
323 extension_misc::LAUNCH_NONE,
324 NEW_WINDOW);
325 params.command_line = CommandLine::ForCurrentProcess();
326 params.current_directory = test_data_dir_;
327 application_launch::OpenApplication(params);
328
329 if (!catcher.GetNextResult()) {
330 message_ = catcher.message();
331 ASSERT_TRUE(0);
332 }
333}
334
[email protected]12e540452012-05-26 07:09:36335// Tests that no launch data is sent through if the platform app provides
336// an intent with the wrong action.
337IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithWrongIntent) {
338 SetCommandLineArg("platform_apps/launch_files/test.txt");
339 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_wrong_intent"))
340 << message_;
341}
342
343// Tests that no launch data is sent through if the file is of the wrong MIME
344// type.
345IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithWrongType) {
346 SetCommandLineArg("platform_apps/launch_files/test.txt");
347 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_wrong_type"))
348 << message_;
349}
350
351// Tests that no launch data is sent through if the platform app does not
352// provide an intent.
353IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNoIntent) {
354 SetCommandLineArg("platform_apps/launch_files/test.txt");
355 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_no_intent"))
356 << message_;
357}
358
359// Tests that no launch data is sent through if the file MIME type cannot
360// be read.
361IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoType) {
362 SetCommandLineArg("platform_apps/launch_files/test.unknownextension");
363 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid"))
364 << message_;
365}
366
367// Tests that no launch data is sent through if the file does not exist.
368IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoFile) {
369 SetCommandLineArg("platform_apps/launch_files/doesnotexist.txt");
370 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid"))
371 << message_;
372}
373
374// Tests that no launch data is sent through if the argument is a directory.
375IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithDirectory) {
376 SetCommandLineArg("platform_apps/launch_files");
377 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid"))
378 << message_;
379}
380
381// Tests that no launch data is sent through if there are no arguments passed
382// on the command line
383IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNothing) {
384 ClearCommandLineArgs();
385 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_nothing"))
386 << message_;
387}
[email protected]ffc7b4d2012-06-08 00:05:32388
389// Test that platform apps can use the chrome.fileSystem.getDisplayPath
390// function to get the native file system path of a file they are launched with.
391IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) {
392 SetCommandLineArg("platform_apps/launch_files/test.txt");
393 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path"))
394 << message_;
395}
396
[email protected]12e540452012-05-26 07:09:36397#endif // defined(OS_CHROMEOS)
[email protected]5b1a04b42012-06-15 00:41:44398
399IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) {
400 ASSERT_TRUE(StartTestServer());
[email protected]a7fe9112012-07-20 02:34:45401 content::WindowedNotificationObserver observer(
[email protected]5b1a04b42012-06-15 00:41:44402 chrome::NOTIFICATION_TAB_ADDED,
403 content::Source<content::WebContentsDelegate>(browser()));
404 LoadAndLaunchPlatformApp("open_link");
405 observer.Wait();
406 ASSERT_EQ(2, browser()->tab_count());
407}
[email protected]d9ede582012-08-14 19:21:38408
[email protected]3a8e61942012-08-23 01:46:45409IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MutationEventsDisabled) {
410 ASSERT_TRUE(RunPlatformAppTest("platform_apps/mutation_events")) << message_;
411}
412
[email protected]d9ede582012-08-14 19:21:38413} // namespace extensions