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 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/base/ui_test_utils.h" 8 #include "extensions/test/result_catcher.h" 9 #include "net/test/embedded_test_server/embedded_test_server.h" 10 #include "url/gurl.h" 11 12 // Tests that we throw errors when you try using extension APIs that aren't 13 // supported in content scripts. 14 // Timey-outy on mac. http://crbug.com/89116 15 #if defined(OS_MACOSX) 16 #define MAYBE_Stubs DISABLED_Stubs 17 #else 18 #define MAYBE_Stubs Stubs 19 #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest,MAYBE_Stubs)20IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Stubs) { 21 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 22 23 ASSERT_TRUE(RunExtensionTest("stubs")) << message_; 24 25 // Navigate to a simple http:// page, which should get the content script 26 // injected and run the rest of the test. 27 GURL url(embedded_test_server()->GetURL("/extensions/test_file.html")); 28 ui_test_utils::NavigateToURL(browser(), url); 29 30 extensions::ResultCatcher catcher; 31 ASSERT_TRUE(catcher.GetNextResult()); 32 } 33 34 // Tests that all API features that are available to a platform app actually 35 // can be used in an app. For example, this test will fail if a developer adds 36 // an API feature without providing a schema. http://crbug.com/369318 IN_PROC_BROWSER_TEST_F(ExtensionApiTest,StubsApp)37IN_PROC_BROWSER_TEST_F(ExtensionApiTest, StubsApp) { 38 ASSERT_TRUE(RunPlatformAppTestWithFlags( 39 "stubs_app", static_cast<int>(kFlagIgnoreManifestWarnings))) 40 << message_; 41 } 42