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