| OLD | NEW |
| 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 #include "googleurl/src/gurl.h" |
| 9 #include "net/test/test_server.h" |
| 8 | 10 |
| 9 // Tests that we throw errors when you try using extension APIs that aren't | 11 // Tests that we throw errors when you try using extension APIs that aren't |
| 10 // supported in content scripts. | 12 // supported in content scripts. |
| 11 // | 13 // |
| 12 // If you have added a new API to extension_api.json and this test starts | 14 // If you have added a new API to extension_api.json and this test starts |
| 13 // failing, most likely you need to either mark it as "unprivileged" (if it | 15 // failing, most likely you need to either mark it as "unprivileged" (if it |
| 14 // should be available in content scripts) or update the list of privileged APIs | 16 // should be available in content scripts) or update the list of privileged APIs |
| 15 // in renderer_extension_bindings.js. | 17 // in renderer_extension_bindings.js. |
| 16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Stubs) { | 18 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Stubs) { |
| 17 HTTPTestServer* server = StartHTTPServer(); | 19 net::HTTPTestServer* server = StartHTTPServer(); |
| 20 ASSERT_TRUE(server); |
| 18 | 21 |
| 19 ASSERT_TRUE(RunExtensionTest("stubs")) << message_; | 22 ASSERT_TRUE(RunExtensionTest("stubs")) << message_; |
| 20 | 23 |
| 21 // Navigate to a simple http:// page, which should get the content script | 24 // Navigate to a simple http:// page, which should get the content script |
| 22 // injected and run the rest of the test. | 25 // injected and run the rest of the test. |
| 23 GURL url = server->TestServerPage("file/extensions/test_file.html"); | 26 GURL url = server->TestServerPage("file/extensions/test_file.html"); |
| 24 ui_test_utils::NavigateToURL(browser(), url); | 27 ui_test_utils::NavigateToURL(browser(), url); |
| 25 | 28 |
| 26 ResultCatcher catcher; | 29 ResultCatcher catcher; |
| 27 ASSERT_TRUE(catcher.GetNextResult()); | 30 ASSERT_TRUE(catcher.GetNextResult()); |
| 28 } | 31 } |
| OLD | NEW |