Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/extensions/features/feature_channel.h" 9 #include "chrome/common/extensions/features/feature_channel.h"
10 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" 10 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 LoadManifest("background_page.json", &error)); 96 LoadManifest("background_page.json", &error));
97 ASSERT_TRUE(manifest.get()); 97 ASSERT_TRUE(manifest.get());
98 manifest->SetBoolean(keys::kBackgroundPersistent, false); 98 manifest->SetBoolean(keys::kBackgroundPersistent, false);
99 manifest->SetInteger(keys::kManifestVersion, 2); 99 manifest->SetInteger(keys::kManifestVersion, 2);
100 scoped_refptr<Extension> extension( 100 scoped_refptr<Extension> extension(
101 LoadAndExpectSuccess(ManifestData(manifest.get(), ""))); 101 LoadAndExpectSuccess(ManifestData(manifest.get(), "")));
102 ASSERT_TRUE(extension.get()); 102 ASSERT_TRUE(extension.get());
103 EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get())); 103 EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get()));
104 104
105 base::ListValue* permissions = new base::ListValue(); 105 base::ListValue* permissions = new base::ListValue();
106 permissions->Append(new base::StringValue("webRequest")); 106 permissions->AppendString("webRequest");
107 manifest->Set(keys::kPermissions, permissions); 107 manifest->Set(keys::kPermissions, permissions);
108 LoadAndExpectError(ManifestData(manifest.get(), ""), 108 LoadAndExpectError(ManifestData(manifest.get(), ""),
109 errors::kWebRequestConflictsWithLazyBackground); 109 errors::kWebRequestConflictsWithLazyBackground);
110 } 110 }
111 111
112 TEST_F(ExtensionManifestBackgroundTest, BackgroundPagePersistentPlatformApp) { 112 TEST_F(ExtensionManifestBackgroundTest, BackgroundPagePersistentPlatformApp) {
113 scoped_refptr<Extension> extension = 113 scoped_refptr<Extension> extension =
114 LoadAndExpectSuccess("background_page_persistent_app.json"); 114 LoadAndExpectSuccess("background_page_persistent_app.json");
115 ASSERT_TRUE(extension->is_platform_app()); 115 ASSERT_TRUE(extension->is_platform_app());
116 ASSERT_TRUE(BackgroundInfo::HasBackgroundPage(extension.get())); 116 ASSERT_TRUE(BackgroundInfo::HasBackgroundPage(extension.get()));
(...skipping 19 matching lines...) Expand all
136 std::string error; 136 std::string error;
137 std::vector<InstallWarning> warnings; 137 std::vector<InstallWarning> warnings;
138 ManifestHandler::ValidateExtension(extension.get(), &error, &warnings); 138 ManifestHandler::ValidateExtension(extension.get(), &error, &warnings);
139 // The key 'background.persistent' is not supported for packaged apps. 139 // The key 'background.persistent' is not supported for packaged apps.
140 EXPECT_EQ(1U, warnings.size()); 140 EXPECT_EQ(1U, warnings.size());
141 EXPECT_EQ(errors::kBackgroundPersistentInvalidForPlatformApps, 141 EXPECT_EQ(errors::kBackgroundPersistentInvalidForPlatformApps,
142 warnings[0].message); 142 warnings[0].message);
143 } 143 }
144 144
145 } // namespace extensions 145 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698