summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_browsertests_misc.cc53
-rw-r--r--chrome/browser/extensions/extension_startup_unittest.cc9
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc6
-rw-r--r--chrome/browser/extensions/stubs_apitest.cc12
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc2
5 files changed, 38 insertions, 44 deletions
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc
index a10446f..6a6d88a 100644
--- a/chrome/browser/extensions/extension_browsertests_misc.cc
+++ b/chrome/browser/extensions/extension_browsertests_misc.cc
@@ -30,6 +30,8 @@
const std::wstring kSubscribePage =
L"files/extensions/subscribe_page_action/subscribe.html";
+const std::wstring kFeedPage = L"files/feeds/feed.html";
+const std::wstring kNoFeedPage = L"files/feeds/no_feed.html";
const std::wstring kValidFeed0 = L"files/feeds/feed_script.xml";
const std::wstring kValidFeed1 = L"files/feeds/feed1.xml";
const std::wstring kValidFeed2 = L"files/feeds/feed2.xml";
@@ -38,6 +40,9 @@ const std::wstring kValidFeed4 = L"files/feeds/feed4.xml";
const std::wstring kValidFeed5 = L"files/feeds/feed5.xml";
const std::wstring kInvalidFeed1 = L"files/feeds/feed_invalid1.xml";
const std::wstring kInvalidFeed2 = L"files/feeds/feed_invalid2.xml";
+const std::wstring kLocalization =
+ L"file/extensions/browsertest/title_localized_pa/simple.html";
+const std::wstring kTestFile = L"file/extensions/test_file.html";
// Looks for an ExtensionHost whose URL has the given path component (including
// leading slash). Also verifies that the expected number of hosts are loaded.
@@ -208,6 +213,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TabContents) {
#if defined(OS_WIN) || defined(OS_LINUX)
// Tests that we can load page actions in the Omnibox.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) {
+ HTTPTestServer* server = StartHTTPServer();
+
// This page action will not show an icon, since it doesn't specify one but
// is included here to test for a crash (http://crbug.com/25562).
ASSERT_TRUE(LoadExtension(
@@ -220,36 +227,28 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) {
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
// Navigate to the feed page.
- FilePath test_dir;
- PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
- FilePath feed = test_dir.AppendASCII("feeds")
- .AppendASCII("feed.html");
-
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(feed));
-
+ GURL feed_url = server->TestServerPageW(kFeedPage);
+ ui_test_utils::NavigateToURL(browser(), feed_url);
// We should now have one page action ready to go in the LocationBar.
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
- FilePath no_feed = test_dir.AppendASCII("feeds")
- .AppendASCII("nofeed.html");
-
+ // Navigate to a page with no feed.
+ GURL no_feed = server->TestServerPageW(kNoFeedPage);
+ ui_test_utils::NavigateToURL(browser(), no_feed);
// Make sure the page action goes away.
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(no_feed));
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0));
}
// Tests that the location bar forgets about unloaded page actions.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) {
+ HTTPTestServer* server = StartHTTPServer();
+
FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action"));
ASSERT_TRUE(LoadExtension(extension_path));
// Navigation prompts the location bar to load page actions.
- FilePath test_dir;
- PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
- FilePath feed = test_dir.AppendASCII("feeds")
- .AppendASCII("feed.html");
-
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(feed));
+ GURL feed_url = server->TestServerPageW(kFeedPage);
+ ui_test_utils::NavigateToURL(browser(), feed_url);
ASSERT_TRUE(WaitForPageActionCountChangeTo(1));
UnloadExtension(last_loaded_extension_id_);
@@ -282,16 +281,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) {
// Tests that tooltips of a page action icon can be specified using UTF8.
// See http://crbug.com/25349.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) {
+ HTTPTestServer* server = StartHTTPServer();
+
FilePath extension_path(test_data_dir_.AppendASCII("browsertest")
.AppendASCII("title_localized_pa"));
ASSERT_TRUE(LoadExtension(extension_path));
// Any navigation prompts the location bar to load the page action.
- FilePath test_dir;
- PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
- FilePath path = extension_path.AppendASCII("simple.html");
-
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path));
+ GURL url = server->TestServerPageW(kLocalization);
+ ui_test_utils::NavigateToURL(browser(), url);
ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1));
ExtensionsService* service = browser()->profile()->GetExtensionsService();
@@ -529,6 +527,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) {
#if defined(OS_WIN) // TODO(port) - enable.
// Tests that message passing between extensions and content scripts works.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MessagingContentScript) {
+ HTTPTestServer* server = StartHTTPServer();
+
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
.AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa")
@@ -550,11 +550,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MessagingContentScript) {
ExtensionHost* host = FindHostWithPath(manager, "/toolstrip.html", 1);
// Load the tab whose content script will communicate with our toolstrip.
- FilePath test_file;
- PathService::Get(chrome::DIR_TEST_DATA, &test_file);
- test_file = test_file.AppendASCII("extensions")
- .AppendASCII("test_file.html");
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file));
+ GURL url = server->TestServerPageW(kTestFile);
+ ui_test_utils::NavigateToURL(browser(), url);
// Test extension->tab messaging.
bool result = false;
@@ -562,7 +559,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MessagingContentScript) {
host->render_view_host(), L"", L"testPostMessage()", &result);
EXPECT_TRUE(result);
- // Test port naming
+ // Test port naming.
result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
host->render_view_host(), L"", L"testPortName()", &result);
diff --git a/chrome/browser/extensions/extension_startup_unittest.cc b/chrome/browser/extensions/extension_startup_unittest.cc
index 00089ae..f076b37 100644
--- a/chrome/browser/extensions/extension_startup_unittest.cc
+++ b/chrome/browser/extensions/extension_startup_unittest.cc
@@ -131,12 +131,9 @@ class ExtensionStartupTestBase
void TestInjection(bool expect_css, bool expect_script) {
// Load a page affected by the content script and test to see the effect.
- FilePath test_file;
- PathService::Get(chrome::DIR_TEST_DATA, &test_file);
- test_file = test_file.AppendASCII("extensions")
- .AppendASCII("test_file.html");
-
- ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file));
+ HTTPTestServer* server = StartHTTPServer();
+ GURL url = server->TestServerPage("file/extensions/test_file.html");
+ ui_test_utils::NavigateToURL(browser(), url);
bool result = false;
ui_test_utils::ExecuteJavaScriptAndExtractBool(
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index f9af689..5024757 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -539,11 +539,11 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectorySuccess) {
extension->toolstrips();
ASSERT_EQ(2u, scripts.size());
EXPECT_EQ(3u, scripts[0].url_patterns().size());
- EXPECT_EQ("file://*",
- scripts[0].url_patterns()[0].GetAsString());
EXPECT_EQ("http://*.google.com/*",
- scripts[0].url_patterns()[1].GetAsString());
+ scripts[0].url_patterns()[0].GetAsString());
EXPECT_EQ("https://*.google.com/*",
+ scripts[0].url_patterns()[1].GetAsString());
+ EXPECT_EQ("http://localhost/*",
scripts[0].url_patterns()[2].GetAsString());
EXPECT_EQ(2u, scripts[0].js_scripts().size());
ExtensionResource resource00(scripts[0].js_scripts()[0].extension_root(),
diff --git a/chrome/browser/extensions/stubs_apitest.cc b/chrome/browser/extensions/stubs_apitest.cc
index 4ba81c7..bdbf69c 100644
--- a/chrome/browser/extensions/stubs_apitest.cc
+++ b/chrome/browser/extensions/stubs_apitest.cc
@@ -15,15 +15,15 @@
// should be available in content scripts) or update the list of privileged APIs
// in renderer_extension_bindings.js.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Stubs) {
+ HTTPTestServer* server = StartHTTPServer();
+
ASSERT_TRUE(RunExtensionTest("stubs")) << message_;
- // Navigate to a simple file:// page, which should get the content script
+ // Navigate to a simple http:// page, which should get the content script
// injected and run the rest of the test.
- FilePath test_dir;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
- FilePath simple_html_path = test_dir.AppendASCII("simple.html");
- ui_test_utils::NavigateToURL(browser(),
- GURL(simple_html_path.value()));
+ GURL url = server->TestServerPage("file/extensions/test_file.html");
+ ui_test_utils::NavigateToURL(browser(), url);
+
ResultCatcher catcher;
ASSERT_TRUE(catcher.GetNextResult());
}
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 35cf1d8..aea50cf 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -295,7 +295,7 @@ TEST_F(UserScriptListenerTest, SingleExtension) {
EXPECT_TRUE(resource_tester_->IsRequestComplete(0));
}
-// Loads a single extension and ensures that requests to URLs with content
+// Loads two extensions and ensures that requests to URLs with content
// scripts are delayed.
TEST_F(UserScriptListenerTest, UnloadExtension) {
FilePath extensions_path;