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

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

Issue 19844003: Remove webkit/plugins/npapi. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove GetDefaultWindowParent 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 | Annotate | Revision Log
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/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "chrome/browser/content_settings/host_content_settings_map.h" 6 #include "chrome/browser/content_settings/host_content_settings_map.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_commands.h" 12 #include "chrome/browser/ui/browser_commands.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/plugin_service.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
20 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
21 #include "webkit/plugins/npapi/plugin_utils.h"
22 22
23 using content::NavigationController; 23 using content::NavigationController;
24 using content::WebContents; 24 using content::WebContents;
25 using extensions::Extension; 25 using extensions::Extension;
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
28 // http://crbug.com/123851 : test flakily fails on win. 28 // http://crbug.com/123851 : test flakily fails on win.
29 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload 29 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload
30 #elif defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) 30 #elif defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)
31 // ExtensionBrowserTest.PluginLoadUnload started failing after the switch to 31 // ExtensionBrowserTest.PluginLoadUnload started failing after the switch to
32 // dynamic ASan runtime library on Mac. See http://crbug.com/234591. 32 // dynamic ASan runtime library on Mac. See http://crbug.com/234591.
33 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload 33 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload
34 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 34 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
35 // Timing out on ARM linux http://crbug.com/238460 35 // Timing out on ARM linux http://crbug.com/238460
36 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload 36 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload
37 #else 37 #else
38 #define MAYBE_PluginLoadUnload PluginLoadUnload 38 #define MAYBE_PluginLoadUnload PluginLoadUnload
39 #endif 39 #endif
40 40
41 // Tests that a renderer's plugin list is properly updated when we load and 41 // Tests that a renderer's plugin list is properly updated when we load and
42 // unload an extension that contains a plugin. 42 // unload an extension that contains a plugin.
43 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { 43 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) {
44 if (!webkit::npapi::NPAPIPluginsSupported()) 44 if (!content::PluginService::GetInstance()->NPAPIPluginsSupported())
45 return; 45 return;
46 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, 46 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize,
47 true); 47 true);
48 48
49 base::FilePath extension_dir = 49 base::FilePath extension_dir =
50 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins"); 50 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins");
51 51
52 ui_test_utils::NavigateToURL(browser(), 52 ui_test_utils::NavigateToURL(browser(),
53 net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); 53 net::FilePathToFileURL(extension_dir.AppendASCII("test.html")));
54 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 54 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Timing out on ARM linux http://crbug.com/238467 117 // Timing out on ARM linux http://crbug.com/238467
118 #define MAYBE_PluginPrivate DISABLED_PluginPrivate 118 #define MAYBE_PluginPrivate DISABLED_PluginPrivate
119 #elif defined(OS_WIN) && defined(ARCH_CPU_X86_64) 119 #elif defined(OS_WIN) && defined(ARCH_CPU_X86_64)
120 // TODO(jschuh): Failing plugin tests. crbug.com/244653 120 // TODO(jschuh): Failing plugin tests. crbug.com/244653
121 #define MAYBE_PluginPrivate DISABLED_PluginPrivate 121 #define MAYBE_PluginPrivate DISABLED_PluginPrivate
122 #else 122 #else
123 #define MAYBE_PluginPrivate PluginPrivate 123 #define MAYBE_PluginPrivate PluginPrivate
124 #endif 124 #endif
125 // Tests that private extension plugins are only visible to the extension. 125 // Tests that private extension plugins are only visible to the extension.
126 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginPrivate) { 126 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginPrivate) {
127 if (!webkit::npapi::NPAPIPluginsSupported()) 127 if (!content::PluginService::GetInstance()->NPAPIPluginsSupported())
128 return; 128 return;
129 129
130 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, 130 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize,
131 true); 131 true);
132 132
133 base::FilePath extension_dir = 133 base::FilePath extension_dir =
134 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins_private"); 134 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins_private");
135 135
136 ExtensionService* service = extensions::ExtensionSystem::Get( 136 ExtensionService* service = extensions::ExtensionSystem::Get(
137 browser()->profile())->extension_service(); 137 browser()->profile())->extension_service();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 EXPECT_TRUE(result); 172 EXPECT_TRUE(result);
173 #endif 173 #endif
174 174
175 // Now load it through a file URL. The plugin should not load. 175 // Now load it through a file URL. The plugin should not load.
176 ui_test_utils::NavigateToURL(browser(), 176 ui_test_utils::NavigateToURL(browser(),
177 net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); 177 net::FilePathToFileURL(extension_dir.AppendASCII("test.html")));
178 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 178 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
179 tab, "testPluginWorks()", &result)); 179 tab, "testPluginWorks()", &result));
180 EXPECT_FALSE(result); 180 EXPECT_FALSE(result);
181 } 181 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/hang_monitor/hung_plugin_action.cc » ('j') | content/common/plugin_constants_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698