| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/extensions/extension_action.h" | 23 #include "chrome/common/extensions/extension_action.h" |
| 24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 25 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
| 26 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
| 27 #include "content/browser/site_instance.h" | 27 #include "content/browser/site_instance.h" |
| 28 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 30 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| 31 #include "net/test/test_server.h" | 31 #include "net/test/test_server.h" |
| 32 #include "webkit/glue/webpreferences.h" |
| 32 | 33 |
| 33 #if defined(TOOLKIT_VIEWS) | 34 #if defined(TOOLKIT_VIEWS) |
| 34 #include "chrome/browser/ui/views/frame/browser_view.h" | 35 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 const std::string kSubscribePage = "/subscribe.html"; | 38 const std::string kSubscribePage = "/subscribe.html"; |
| 38 const std::string kFeedPage = "files/feeds/feed.html"; | 39 const std::string kFeedPage = "files/feeds/feed.html"; |
| 39 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; | 40 const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; |
| 40 const std::string kNoFeedPage = "files/feeds/no_feed.html"; | 41 const std::string kNoFeedPage = "files/feeds/no_feed.html"; |
| 41 const std::string kValidFeed0 = "files/feeds/feed_script.xml"; | 42 const std::string kValidFeed0 = "files/feeds/feed_script.xml"; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // pages. See http://crbug.com/64512. | 115 // pages. See http://crbug.com/64512. |
| 115 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebKitPrefsBackgroundPage) { | 116 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebKitPrefsBackgroundPage) { |
| 116 ASSERT_TRUE(LoadExtension( | 117 ASSERT_TRUE(LoadExtension( |
| 117 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 118 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") |
| 118 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 119 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 119 .AppendASCII("1.0.0.0"))); | 120 .AppendASCII("1.0.0.0"))); |
| 120 | 121 |
| 121 ExtensionProcessManager* manager = | 122 ExtensionProcessManager* manager = |
| 122 browser()->profile()->GetExtensionProcessManager(); | 123 browser()->profile()->GetExtensionProcessManager(); |
| 123 ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); | 124 ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); |
| 124 WebPreferences prefs = host->GetWebkitPrefs(); | 125 WebPreferences prefs = |
| 126 static_cast<RenderViewHostDelegate*>(host->host_contents())-> |
| 127 GetWebkitPrefs(); |
| 125 ASSERT_FALSE(prefs.experimental_webgl_enabled); | 128 ASSERT_FALSE(prefs.experimental_webgl_enabled); |
| 126 ASSERT_FALSE(prefs.accelerated_compositing_enabled); | 129 ASSERT_FALSE(prefs.accelerated_compositing_enabled); |
| 127 ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); | 130 ASSERT_FALSE(prefs.accelerated_2d_canvas_enabled); |
| 128 } | 131 } |
| 129 | 132 |
| 130 // Tests that we can load page actions in the Omnibox. | 133 // Tests that we can load page actions in the Omnibox. |
| 131 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { | 134 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { |
| 132 ASSERT_TRUE(test_server()->Start()); | 135 ASSERT_TRUE(test_server()->Start()); |
| 133 | 136 |
| 134 // This page action will not show an icon, since it doesn't specify one but | 137 // This page action will not show an icon, since it doesn't specify one but |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 847 |
| 845 EXPECT_EQ(extension->GetResourceURL("options.html"), | 848 EXPECT_EQ(extension->GetResourceURL("options.html"), |
| 846 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); | 849 tab_strip->GetTabContentsAt(1)->tab_contents()->GetURL()); |
| 847 } | 850 } |
| 848 | 851 |
| 849 //============================================================================== | 852 //============================================================================== |
| 850 // STOP! Please do not add any more random-ass tests here. Create new files for | 853 // STOP! Please do not add any more random-ass tests here. Create new files for |
| 851 // your tests grouped by functionality. Also, you should strongly consider using | 854 // your tests grouped by functionality. Also, you should strongly consider using |
| 852 // ExtensionAPITest if possible. | 855 // ExtensionAPITest if possible. |
| 853 //============================================================================== | 856 //============================================================================== |
| OLD | NEW |