blob: d1e78d1b43030a492f9e011e498902c126040ba8 [file] [log] [blame]
[email protected]1c3cf8b2010-05-11 23:18:271// 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
11class AppBackgroundPageApiTest : public ExtensionApiTest {
12 public:
13 void SetUpCommandLine(CommandLine* command_line) {
14 ExtensionApiTest::SetUpCommandLine(command_line);
[email protected]1c3cf8b2010-05-11 23:18:2715 command_line->AppendSwitch(switches::kDisablePopupBlocking);
16 }
17};
18
[email protected]4dca3172010-09-19 20:40:1519IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, Basic) {
[email protected]1c3cf8b2010-05-11 23:18:2720 host_resolver()->AddRule("a.com", "127.0.0.1");
[email protected]e18a19b2010-10-19 20:32:3021 ASSERT_TRUE(StartTestServer());
[email protected]1c3cf8b2010-05-11 23:18:2722
23 LoadExtension(test_data_dir_.AppendASCII(
24 "app_background_page/app_has_permission"));
25 ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_;
26}
27
28IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, LacksPermission) {
29 host_resolver()->AddRule("a.com", "127.0.0.1");
[email protected]e18a19b2010-10-19 20:32:3030 ASSERT_TRUE(StartTestServer());
[email protected]1c3cf8b2010-05-11 23:18:2731
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}