Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
| 8 #include "chrome/test/ui_test_utils.h" | 8 #include "chrome/test/ui_test_utils.h" |
| 9 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
| 10 | 10 |
| 11 class AppBackgroundPageApiTest : public ExtensionApiTest { | 11 class AppBackgroundPageApiTest : public ExtensionApiTest { |
| 12 public: | 12 public: |
| 13 void SetUpCommandLine(CommandLine* command_line) { | 13 void SetUpCommandLine(CommandLine* command_line) { |
| 14 ExtensionApiTest::SetUpCommandLine(command_line); | 14 ExtensionApiTest::SetUpCommandLine(command_line); |
| 15 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 15 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
| 16 // Tests rely on chrome exiting, so disable background mode. | |
| 17 command_line->AppendSwitch(switches::kDisableBackgroundMode); | |
|
Dmitry Titov
2010/08/24 19:33:18
should we just remove kDisableBackgroundMode now t
| |
| 18 } | 16 } |
| 19 }; | 17 }; |
| 20 | 18 |
| 21 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) { | 19 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) { |
| 22 host_resolver()->AddRule("a.com", "127.0.0.1"); | 20 host_resolver()->AddRule("a.com", "127.0.0.1"); |
| 23 ASSERT_TRUE(test_server()->Start()); | 21 ASSERT_TRUE(test_server()->Start()); |
| 24 | 22 |
| 25 LoadExtension(test_data_dir_.AppendASCII( | 23 LoadExtension(test_data_dir_.AppendASCII( |
| 26 "app_background_page/app_has_permission")); | 24 "app_background_page/app_has_permission")); |
| 27 ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_; | 25 ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_; |
| 28 } | 26 } |
| 29 | 27 |
| 30 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, LacksPermission) { | 28 IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, LacksPermission) { |
| 31 host_resolver()->AddRule("a.com", "127.0.0.1"); | 29 host_resolver()->AddRule("a.com", "127.0.0.1"); |
| 32 ASSERT_TRUE(test_server()->Start()); | 30 ASSERT_TRUE(test_server()->Start()); |
| 33 | 31 |
| 34 LoadExtension(test_data_dir_.AppendASCII( | 32 LoadExtension(test_data_dir_.AppendASCII( |
| 35 "app_background_page/app_lacks_permission")); | 33 "app_background_page/app_lacks_permission")); |
| 36 ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission")) | 34 ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission")) |
| 37 << message_; | 35 << message_; |
| 38 } | 36 } |
| OLD | NEW |