[email protected] | 1c3cf8b | 2010-05-11 23:18:27 | [diff] [blame] | 1 | // Copyright (c) 2010 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/browser.h" |
| 6 | #include "chrome/browser/extensions/extension_apitest.h" |
| 7 | #include "chrome/common/chrome_switches.h" |
| 8 | #include "chrome/test/ui_test_utils.h" |
| 9 | #include "net/base/mock_host_resolver.h" |
| 10 | |
| 11 | class AppBackgroundPageApiTest : public ExtensionApiTest { |
| 12 | public: |
| 13 | void SetUpCommandLine(CommandLine* command_line) { |
| 14 | ExtensionApiTest::SetUpCommandLine(command_line); |
[email protected] | 1c3cf8b | 2010-05-11 23:18:27 | [diff] [blame] | 15 | command_line->AppendSwitch(switches::kDisablePopupBlocking); |
| 16 | } |
| 17 | }; |
| 18 | |
[email protected] | 4dca317 | 2010-09-19 20:40:15 | [diff] [blame] | 19 | IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) { |
[email protected] | 1c3cf8b | 2010-05-11 23:18:27 | [diff] [blame] | 20 | host_resolver()->AddRule("a.com", "127.0.0.1"); |
[email protected] | e18a19b | 2010-10-19 20:32:30 | [diff] [blame^] | 21 | ASSERT_TRUE(StartTestServer()); |
[email protected] | 1c3cf8b | 2010-05-11 23:18:27 | [diff] [blame] | 22 | |
| 23 | LoadExtension(test_data_dir_.AppendASCII( |
| 24 | "app_background_page/app_has_permission")); |
| 25 | ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_; |
| 26 | } |
| 27 | |
| 28 | IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, LacksPermission) { |
| 29 | host_resolver()->AddRule("a.com", "127.0.0.1"); |
[email protected] | e18a19b | 2010-10-19 20:32:30 | [diff] [blame^] | 30 | ASSERT_TRUE(StartTestServer()); |
[email protected] | 1c3cf8b | 2010-05-11 23:18:27 | [diff] [blame] | 31 | |
| 32 | LoadExtension(test_data_dir_.AppendASCII( |
| 33 | "app_background_page/app_lacks_permission")); |
| 34 | ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission")) |
| 35 | << message_; |
| 36 | } |