OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/extensions/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 EXPECT_FALSE(extension->allow_background_js_access()); | 82 EXPECT_FALSE(extension->allow_background_js_access()); |
83 | 83 |
84 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json"); | 84 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json"); |
85 ASSERT_TRUE(extension); | 85 ASSERT_TRUE(extension); |
86 EXPECT_FALSE(extension->allow_background_js_access()); | 86 EXPECT_FALSE(extension->allow_background_js_access()); |
87 } | 87 } |
88 | 88 |
89 TEST_F(ExtensionManifestTest, BackgroundPageWebRequest) { | 89 TEST_F(ExtensionManifestTest, BackgroundPageWebRequest) { |
90 CommandLine::ForCurrentProcess()->AppendSwitch( | 90 CommandLine::ForCurrentProcess()->AppendSwitch( |
91 switches::kEnableExperimentalExtensionApis); | 91 switches::kEnableExperimentalExtensionApis); |
92 Feature::SetChannelForTesting(chrome::VersionInfo::CHANNEL_UNKNOWN); | 92 Feature::ScopedCurrentChannel current_channel( |
| 93 chrome::VersionInfo::CHANNEL_DEV); |
93 | 94 |
94 std::string error; | 95 std::string error; |
95 scoped_ptr<DictionaryValue> manifest( | 96 scoped_ptr<DictionaryValue> manifest( |
96 LoadManifestFile("background_page.json", &error)); | 97 LoadManifestFile("background_page.json", &error)); |
97 ASSERT_TRUE(manifest.get()); | 98 ASSERT_TRUE(manifest.get()); |
98 manifest->SetBoolean(keys::kBackgroundPersistent, false); | 99 manifest->SetBoolean(keys::kBackgroundPersistent, false); |
99 manifest->SetInteger(keys::kManifestVersion, 2); | 100 manifest->SetInteger(keys::kManifestVersion, 2); |
100 scoped_refptr<Extension> extension( | 101 scoped_refptr<Extension> extension( |
101 LoadAndExpectSuccess(Manifest(manifest.get(), ""))); | 102 LoadAndExpectSuccess(Manifest(manifest.get(), ""))); |
102 ASSERT_TRUE(extension); | 103 ASSERT_TRUE(extension); |
103 EXPECT_TRUE(extension->has_lazy_background_page()); | 104 EXPECT_TRUE(extension->has_lazy_background_page()); |
104 | 105 |
105 ListValue* permissions = new ListValue(); | 106 ListValue* permissions = new ListValue(); |
106 permissions->Append(Value::CreateStringValue("webRequest")); | 107 permissions->Append(Value::CreateStringValue("webRequest")); |
107 manifest->Set(keys::kPermissions, permissions); | 108 manifest->Set(keys::kPermissions, permissions); |
108 LoadAndExpectError(Manifest(manifest.get(), ""), | 109 LoadAndExpectError(Manifest(manifest.get(), ""), |
109 errors::kWebRequestConflictsWithLazyBackground); | 110 errors::kWebRequestConflictsWithLazyBackground); |
110 } | 111 } |
111 | 112 |
112 } // namespace extensions | 113 } // namespace extensions |
OLD | NEW |