blob: ec28c8fdc8b0ba9398136e77d7b4c300d763e804 [file] [log] [blame]
[email protected]af44e7fb2011-07-29 18:32:321// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]13079012009-11-13 22:22:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
avia2f4804a2015-12-24 23:11:135#include "build/build_config.h"
[email protected]13079012009-11-13 22:22:556#include "chrome/browser/extensions/extension_apitest.h"
7#include "chrome/common/chrome_paths.h"
[email protected]af44e7fb2011-07-29 18:32:328#include "chrome/test/base/ui_test_utils.h"
yoze8dc2f12014-09-09 23:16:329#include "extensions/test/result_catcher.h"
[email protected]c1dffe82013-06-26 20:59:0510#include "net/test/embedded_test_server/embedded_test_server.h"
[email protected]a6483d22013-07-03 22:11:0011#include "url/gurl.h"
[email protected]13079012009-11-13 22:22:5512
Devlin Croninef3e37e2018-05-14 23:47:2413namespace extensions {
14
[email protected]13079012009-11-13 22:22:5515// Tests that we throw errors when you try using extension APIs that aren't
16// supported in content scripts.
[email protected]c0c391462011-07-12 23:52:3217// Timey-outy on mac. http://crbug.com/89116
18#if defined(OS_MACOSX)
19#define MAYBE_Stubs DISABLED_Stubs
20#else
21#define MAYBE_Stubs Stubs
22#endif
23IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Stubs) {
svaldeza01f7d92015-11-18 17:47:5624 ASSERT_TRUE(embedded_test_server()->Start());
[email protected]5f8681f2009-11-18 03:21:1325
[email protected]13079012009-11-13 22:22:5526 ASSERT_TRUE(RunExtensionTest("stubs")) << message_;
27
[email protected]5f8681f2009-11-18 03:21:1328 // Navigate to a simple http:// page, which should get the content script
[email protected]13079012009-11-13 22:22:5529 // injected and run the rest of the test.
[email protected]c1dffe82013-06-26 20:59:0530 GURL url(embedded_test_server()->GetURL("/extensions/test_file.html"));
[email protected]5f8681f2009-11-18 03:21:1331 ui_test_utils::NavigateToURL(browser(), url);
32
Devlin Croninef3e37e2018-05-14 23:47:2433 ResultCatcher catcher;
[email protected]13079012009-11-13 22:22:5534 ASSERT_TRUE(catcher.GetNextResult());
35}
[email protected]d241de72014-05-16 04:19:0936
37// Tests that all API features that are available to a platform app actually
38// can be used in an app. For example, this test will fail if a developer adds
39// an API feature without providing a schema. http://crbug.com/369318
40IN_PROC_BROWSER_TEST_F(ExtensionApiTest, StubsApp) {
[email protected]6e3275c2014-06-23 23:22:1841 ASSERT_TRUE(RunPlatformAppTestWithFlags(
42 "stubs_app", static_cast<int>(kFlagIgnoreManifestWarnings)))
43 << message_;
[email protected]d241de72014-05-16 04:19:0944}
Devlin Croninef3e37e2018-05-14 23:47:2445
46} // namespace extensions