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

Side by Side Diff: chrome/browser/extensions/platform_app_browsertest.cc

Issue 18192003: Add tests for ShellWindowLinkDelegate::OpenURLFromTab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 598 }
599 599
600 // Test that platform apps can use the chrome.fileSystem.getDisplayPath 600 // Test that platform apps can use the chrome.fileSystem.getDisplayPath
601 // function to get the native file system path of a file they are launched with. 601 // function to get the native file system path of a file they are launched with.
602 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { 602 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) {
603 SetCommandLineArg(kTestFilePath); 603 SetCommandLineArg(kTestFilePath);
604 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path")) 604 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path"))
605 << message_; 605 << message_;
606 } 606 }
607 607
608 // Test that ShellWindowLinkDelegate::OpenURLFromTab doesn't crash. This code
609 // relies on the WebContents implementation not dereferencing the Source
610 // WebContents after ShellWindowLinkDelegate frees it.
611 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ExternalOpenLink) {
612 ShellWindow::EnableExternalOpenForTesting();
613 ASSERT_TRUE(RunPlatformAppTest("platform_apps/external_open_link"));
614 ShellWindow::DisableExternalOpenForTesting();
615 }
616
608 #endif // defined(OS_CHROMEOS) 617 #endif // defined(OS_CHROMEOS)
609 618
610 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { 619 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) {
611 ASSERT_TRUE(StartEmbeddedTestServer()); 620 ASSERT_TRUE(StartEmbeddedTestServer());
612 content::WindowedNotificationObserver observer( 621 content::WindowedNotificationObserver observer(
613 chrome::NOTIFICATION_TAB_ADDED, 622 chrome::NOTIFICATION_TAB_ADDED,
614 content::Source<content::WebContentsDelegate>(browser())); 623 content::Source<content::WebContentsDelegate>(browser()));
615 LoadAndLaunchPlatformApp("open_link"); 624 LoadAndLaunchPlatformApp("open_link");
616 observer.Wait(); 625 observer.Wait();
617 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 626 ASSERT_EQ(2, browser()->tab_strip_model()->count());
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 1086
1078 while (!ContainsKey(opener_app_ids_, file_manager->id())) { 1087 while (!ContainsKey(opener_app_ids_, file_manager->id())) {
1079 content::RunAllPendingInMessageLoop(); 1088 content::RunAllPendingInMessageLoop();
1080 } 1089 }
1081 } 1090 }
1082 1091
1083 #endif // defined(OS_CHROMEOS) 1092 #endif // defined(OS_CHROMEOS)
1084 1093
1085 1094
1086 } // namespace extensions 1095 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/shell_window.h » ('j') | chrome/browser/ui/extensions/shell_window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698