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

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

Issue 402029: Don't allow content scripts to execute on file:// urls.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/common/chrome_paths.h" 6 #include "chrome/common/chrome_paths.h"
7 #include "chrome/test/ui_test_utils.h" 7 #include "chrome/test/ui_test_utils.h"
8 8
9 #if defined(OS_WIN) // TODO(asargent) get this working on linux 9 #if defined(OS_WIN) // TODO(asargent) get this working on linux
10 // Tests that we throw errors when you try using extension APIs that aren't 10 // Tests that we throw errors when you try using extension APIs that aren't
11 // supported in content scripts. 11 // supported in content scripts.
12 // 12 //
13 // If you have added a new API to extension_api.json and this test starts 13 // If you have added a new API to extension_api.json and this test starts
14 // failing, most likely you need to either mark it as "unprivileged" (if it 14 // failing, most likely you need to either mark it as "unprivileged" (if it
15 // should be available in content scripts) or update the list of privileged APIs 15 // should be available in content scripts) or update the list of privileged APIs
16 // in renderer_extension_bindings.js. 16 // in renderer_extension_bindings.js.
17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Stubs) { 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Stubs) {
18 HTTPTestServer* server = StartHTTPServer();
19
18 ASSERT_TRUE(RunExtensionTest("stubs")) << message_; 20 ASSERT_TRUE(RunExtensionTest("stubs")) << message_;
19 21
20 // Navigate to a simple file:// page, which should get the content script 22 // Navigate to a simple http:// page, which should get the content script
21 // injected and run the rest of the test. 23 // injected and run the rest of the test.
22 FilePath test_dir; 24 GURL url = server->TestServerPage("file/extensions/test_file.html");
23 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 25 ui_test_utils::NavigateToURL(browser(), url);
24 FilePath simple_html_path = test_dir.AppendASCII("simple.html"); 26
25 ui_test_utils::NavigateToURL(browser(),
26 GURL(simple_html_path.value()));
27 ResultCatcher catcher; 27 ResultCatcher catcher;
28 ASSERT_TRUE(catcher.GetNextResult()); 28 ASSERT_TRUE(catcher.GetNextResult());
29 } 29 }
30 #endif 30 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service_unittest.cc ('k') | chrome/browser/extensions/user_script_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698