OLD | NEW |
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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 8 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
11 #include "chrome/browser/extensions/extension_error_reporter.h" | 11 #include "chrome/browser/extensions/extension_error_reporter.h" |
12 #include "chrome/browser/extensions/extension_host.h" | 12 #include "chrome/browser/extensions/extension_host.h" |
13 #include "chrome/browser/extensions/extension_process_manager.h" | 13 #include "chrome/browser/extensions/extension_process_manager.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/extension_tab_util.h" | 15 #include "chrome/browser/extensions/extension_tab_util.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
| 25 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
25 #include "chrome/test/base/ui_test_utils.h" | 27 #include "chrome/test/base/ui_test_utils.h" |
26 #include "content/public/browser/navigation_entry.h" | 28 #include "content/public/browser/navigation_entry.h" |
27 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
29 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
30 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
31 #include "net/test/test_server.h" | 33 #include "net/test/test_server.h" |
32 #include "webkit/glue/webpreferences.h" | 34 #include "webkit/glue/webpreferences.h" |
33 | 35 |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 // http://crbug.com/47598 | 716 // http://crbug.com/47598 |
715 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload | 717 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload |
716 #else | 718 #else |
717 // TODO(mpcomplete): http://crbug.com/29900 need cross platform plugin support. | 719 // TODO(mpcomplete): http://crbug.com/29900 need cross platform plugin support. |
718 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload | 720 #define MAYBE_PluginLoadUnload DISABLED_PluginLoadUnload |
719 #endif | 721 #endif |
720 | 722 |
721 // Tests that a renderer's plugin list is properly updated when we load and | 723 // Tests that a renderer's plugin list is properly updated when we load and |
722 // unload an extension that contains a plugin. | 724 // unload an extension that contains a plugin. |
723 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { | 725 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { |
| 726 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, |
| 727 true); |
| 728 |
724 FilePath extension_dir = | 729 FilePath extension_dir = |
725 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins"); | 730 test_data_dir_.AppendASCII("uitest").AppendASCII("plugins"); |
726 | 731 |
727 ui_test_utils::NavigateToURL(browser(), | 732 ui_test_utils::NavigateToURL(browser(), |
728 net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); | 733 net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); |
729 WebContents* tab = browser()->GetSelectedWebContents(); | 734 WebContents* tab = browser()->GetSelectedWebContents(); |
730 | 735 |
731 // With no extensions, the plugin should not be loaded. | 736 // With no extensions, the plugin should not be loaded. |
732 bool result = false; | 737 bool result = false; |
733 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 738 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 | 855 |
851 EXPECT_EQ(extension->GetResourceURL("options.html"), | 856 EXPECT_EQ(extension->GetResourceURL("options.html"), |
852 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); | 857 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); |
853 } | 858 } |
854 | 859 |
855 //============================================================================== | 860 //============================================================================== |
856 // STOP! Please do not add any more random-ass tests here. Create new files for | 861 // STOP! Please do not add any more random-ass tests here. Create new files for |
857 // your tests grouped by functionality. Also, you should strongly consider using | 862 // your tests grouped by functionality. Also, you should strongly consider using |
858 // ExtensionAPITest if possible. | 863 // ExtensionAPITest if possible. |
859 //============================================================================== | 864 //============================================================================== |
OLD | NEW |