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

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

Issue 78303005: ContentSettings API should not interact with <webview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified patch according to comments Created 7 years 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 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 "apps/ui/native_app_window.h" 5 #include "apps/ui/native_app_window.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/apps/app_browsertest_util.h" 9 #include "chrome/browser/apps/app_browsertest_util.h"
10 #include "chrome/browser/automation/automation_util.h" 10 #include "chrome/browser/automation/automation_util.h"
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 IN_PROC_BROWSER_TEST_F(WebViewTest, WhitelistedContentScript) { 1696 IN_PROC_BROWSER_TEST_F(WebViewTest, WhitelistedContentScript) {
1697 // Whitelist the extension for running content script we are going to load. 1697 // Whitelist the extension for running content script we are going to load.
1698 extensions::ExtensionsClient::ScriptingWhitelist whitelist; 1698 extensions::ExtensionsClient::ScriptingWhitelist whitelist;
1699 const std::string extension_id = "imeongpbjoodlnmlakaldhlcmijmhpbb"; 1699 const std::string extension_id = "imeongpbjoodlnmlakaldhlcmijmhpbb";
1700 whitelist.push_back(extension_id); 1700 whitelist.push_back(extension_id);
1701 extensions::ExtensionsClient::Get()->SetScriptingWhitelist(whitelist); 1701 extensions::ExtensionsClient::Get()->SetScriptingWhitelist(whitelist);
1702 1702
1703 // Load the extension. 1703 // Load the extension.
1704 const extensions::Extension* content_script_whitelisted_extension = 1704 const extensions::Extension* content_script_whitelisted_extension =
1705 LoadExtension(test_data_dir_.AppendASCII( 1705 LoadExtension(test_data_dir_.AppendASCII(
1706 "platform_apps/web_view/legacy/content_script")); 1706 "platform_apps/web_view/extension_api/content_script"));
1707 ASSERT_TRUE(content_script_whitelisted_extension); 1707 ASSERT_TRUE(content_script_whitelisted_extension);
1708 ASSERT_EQ(extension_id, content_script_whitelisted_extension->id()); 1708 ASSERT_EQ(extension_id, content_script_whitelisted_extension->id());
1709 1709
1710 // Now load an app with <webview>. 1710 // Now load an app with <webview>.
1711 ExtensionTestMessageListener done_listener("TEST_PASSED", false); 1711 ExtensionTestMessageListener done_listener("TEST_PASSED", false);
1712 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted"); 1712 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted");
1713 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); 1713 ASSERT_TRUE(done_listener.WaitUntilSatisfied());
1714 } 1714 }
1715 1715
1716 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) { 1716 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 // Fails on official Windows and Linux builds. See http://crbug.com/313868 1789 // Fails on official Windows and Linux builds. See http://crbug.com/313868
1790 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX)) 1790 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
1791 #define MAYBE_Dialog_TestPromptDialog DISABLED_Dialog_TestPromptDialog 1791 #define MAYBE_Dialog_TestPromptDialog DISABLED_Dialog_TestPromptDialog
1792 #else 1792 #else
1793 #define MAYBE_Dialog_TestPromptDialog Dialog_TestPromptDialog 1793 #define MAYBE_Dialog_TestPromptDialog Dialog_TestPromptDialog
1794 #endif 1794 #endif
1795 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Dialog_TestPromptDialog) { 1795 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_Dialog_TestPromptDialog) {
1796 TestHelper("testPromptDialog", "web_view/dialog", NO_TEST_SERVER); 1796 TestHelper("testPromptDialog", "web_view/dialog", NO_TEST_SERVER);
1797 } 1797 }
1798 1798
1799 IN_PROC_BROWSER_TEST_F(WebViewTest, NoContentSettingsAPI) {
1800 // Load the extension.
1801 const extensions::Extension* content_settings_extension =
1802 LoadExtension(
1803 test_data_dir_.AppendASCII(
1804 "platform_apps/web_view/extension_api/content_settings"));
1805 ASSERT_TRUE(content_settings_extension);
1806 TestHelper("testPostMessageCommChannel", "web_view/shim", NO_TEST_SERVER);
1807 }
1808
1799 #if defined(ENABLE_PLUGINS) 1809 #if defined(ENABLE_PLUGINS)
1800 class WebViewPluginTest : public WebViewTest { 1810 class WebViewPluginTest : public WebViewTest {
1801 protected: 1811 protected:
1802 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 1812 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
1803 WebViewTest::SetUpCommandLine(command_line); 1813 WebViewTest::SetUpCommandLine(command_line);
1804 1814
1805 // Append the switch to register the pepper plugin. 1815 // Append the switch to register the pepper plugin.
1806 // library name = <out dir>/<test_name>.<library_extension> 1816 // library name = <out dir>/<test_name>.<library_extension>
1807 // MIME type = application/x-ppapi-<test_name> 1817 // MIME type = application/x-ppapi-<test_name>
1808 base::FilePath plugin_dir; 1818 base::FilePath plugin_dir;
1809 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); 1819 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
1810 1820
1811 base::FilePath plugin_lib = plugin_dir.Append(library_name); 1821 base::FilePath plugin_lib = plugin_dir.Append(library_name);
1812 EXPECT_TRUE(base::PathExists(plugin_lib)); 1822 EXPECT_TRUE(base::PathExists(plugin_lib));
1813 base::FilePath::StringType pepper_plugin = plugin_lib.value(); 1823 base::FilePath::StringType pepper_plugin = plugin_lib.value();
1814 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); 1824 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests"));
1815 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 1825 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
1816 pepper_plugin); 1826 pepper_plugin);
1817 } 1827 }
1818 }; 1828 };
1819 1829
1820 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) { 1830 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) {
1821 TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER); 1831 TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER);
1822 } 1832 }
1823 #endif // defined(ENABLE_PLUGINS) 1833 #endif // defined(ENABLE_PLUGINS)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | chrome/browser/chrome_content_browser_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698