[email protected] | af44e7fb | 2011-07-29 18:32:32 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
avi | a2f4804a | 2015-12-24 23:11:13 | [diff] [blame] | 5 | #include "build/build_config.h" |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 6 | #include "chrome/browser/extensions/extension_apitest.h" |
7 | #include "chrome/common/chrome_paths.h" | ||||
[email protected] | af44e7fb | 2011-07-29 18:32:32 | [diff] [blame] | 8 | #include "chrome/test/base/ui_test_utils.h" |
yoz | e8dc2f1 | 2014-09-09 23:16:32 | [diff] [blame] | 9 | #include "extensions/test/result_catcher.h" |
[email protected] | c1dffe8 | 2013-06-26 20:59:05 | [diff] [blame] | 10 | #include "net/test/embedded_test_server/embedded_test_server.h" |
[email protected] | a6483d2 | 2013-07-03 22:11:00 | [diff] [blame] | 11 | #include "url/gurl.h" |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 12 | |
Devlin Cronin | ef3e37e | 2018-05-14 23:47:24 | [diff] [blame] | 13 | namespace extensions { |
14 | |||||
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 15 | // Tests that we throw errors when you try using extension APIs that aren't |
16 | // supported in content scripts. | ||||
[email protected] | c0c39146 | 2011-07-12 23:52:32 | [diff] [blame] | 17 | // 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 | ||||
23 | IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Stubs) { | ||||
svaldez | a01f7d9 | 2015-11-18 17:47:56 | [diff] [blame] | 24 | ASSERT_TRUE(embedded_test_server()->Start()); |
[email protected] | 5f8681f | 2009-11-18 03:21:13 | [diff] [blame] | 25 | |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 26 | ASSERT_TRUE(RunExtensionTest("stubs")) << message_; |
27 | |||||
[email protected] | 5f8681f | 2009-11-18 03:21:13 | [diff] [blame] | 28 | // Navigate to a simple http:// page, which should get the content script |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 29 | // injected and run the rest of the test. |
[email protected] | c1dffe8 | 2013-06-26 20:59:05 | [diff] [blame] | 30 | GURL url(embedded_test_server()->GetURL("/extensions/test_file.html")); |
[email protected] | 5f8681f | 2009-11-18 03:21:13 | [diff] [blame] | 31 | ui_test_utils::NavigateToURL(browser(), url); |
32 | |||||
Devlin Cronin | ef3e37e | 2018-05-14 23:47:24 | [diff] [blame] | 33 | ResultCatcher catcher; |
[email protected] | 1307901 | 2009-11-13 22:22:55 | [diff] [blame] | 34 | ASSERT_TRUE(catcher.GetNextResult()); |
35 | } | ||||
[email protected] | d241de7 | 2014-05-16 04:19:09 | [diff] [blame] | 36 | |
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 | ||||
40 | IN_PROC_BROWSER_TEST_F(ExtensionApiTest, StubsApp) { | ||||
[email protected] | 6e3275c | 2014-06-23 23:22:18 | [diff] [blame] | 41 | ASSERT_TRUE(RunPlatformAppTestWithFlags( |
42 | "stubs_app", static_cast<int>(kFlagIgnoreManifestWarnings))) | ||||
43 | << message_; | ||||
[email protected] | d241de7 | 2014-05-16 04:19:09 | [diff] [blame] | 44 | } |
Devlin Cronin | ef3e37e | 2018-05-14 23:47:24 | [diff] [blame] | 45 | |
46 | } // namespace extensions |