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/chrome_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/chrome_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/extensions/features/feature_channel.h" | 10 #include "chrome/common/extensions/features/feature_channel.h" |
(...skipping 70 matching lines...) Loading... |
81 extension = LoadAndExpectSuccess("background_allow_no_js_access.json"); | 81 extension = LoadAndExpectSuccess("background_allow_no_js_access.json"); |
82 ASSERT_TRUE(extension.get()); | 82 ASSERT_TRUE(extension.get()); |
83 EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get())); | 83 EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get())); |
84 | 84 |
85 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json"); | 85 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json"); |
86 ASSERT_TRUE(extension.get()); | 86 ASSERT_TRUE(extension.get()); |
87 EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get())); | 87 EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get())); |
88 } | 88 } |
89 | 89 |
90 TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) { | 90 TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) { |
91 ScopedCurrentChannel current_channel(chrome::VersionInfo::CHANNEL_DEV); | 91 ScopedCurrentChannel current_channel(version_info::Channel::DEV); |
92 | 92 |
93 std::string error; | 93 std::string error; |
94 scoped_ptr<base::DictionaryValue> manifest( | 94 scoped_ptr<base::DictionaryValue> manifest( |
95 LoadManifest("background_page.json", &error)); | 95 LoadManifest("background_page.json", &error)); |
96 ASSERT_TRUE(manifest.get()); | 96 ASSERT_TRUE(manifest.get()); |
97 manifest->SetBoolean(keys::kBackgroundPersistent, false); | 97 manifest->SetBoolean(keys::kBackgroundPersistent, false); |
98 manifest->SetInteger(keys::kManifestVersion, 2); | 98 manifest->SetInteger(keys::kManifestVersion, 2); |
99 scoped_refptr<Extension> extension( | 99 scoped_refptr<Extension> extension( |
100 LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); | 100 LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); |
101 ASSERT_TRUE(extension.get()); | 101 ASSERT_TRUE(extension.get()); |
102 EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); | 102 EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); |
103 | 103 |
104 base::ListValue* permissions = new base::ListValue(); | 104 base::ListValue* permissions = new base::ListValue(); |
105 permissions->Append(new base::StringValue("webRequest")); | 105 permissions->Append(new base::StringValue("webRequest")); |
106 manifest->Set(keys::kPermissions, permissions); | 106 manifest->Set(keys::kPermissions, permissions); |
107 LoadAndExpectError(ManifestData(manifest.get(), ""), | 107 LoadAndExpectError(ManifestData(manifest.get(), ""), |
108 errors::kWebRequestConflictsWithLazyBackground); | 108 errors::kWebRequestConflictsWithLazyBackground); |
109 } | 109 } |
110 | 110 |
111 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |