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

Side by Side Diff: chrome/browser/extensions/extension_management_unittest.cc

Issue 2888073002: Remove raw DictionaryValue::Set in //chrome (Closed)
Patch Set: Fix Tests Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/extension_management.h" 5 #include "chrome/browser/extensions/extension_management.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/json/json_parser.h" 12 #include "base/json/json_parser.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/extensions/extension_management_internal.h" 15 #include "chrome/browser/extensions/extension_management_internal.h"
15 #include "chrome/browser/extensions/extension_management_test_util.h" 16 #include "chrome/browser/extensions/extension_management_test_util.h"
16 #include "chrome/browser/extensions/external_policy_loader.h" 17 #include "chrome/browser/extensions/external_policy_loader.h"
17 #include "chrome/browser/extensions/standard_management_policy_provider.h" 18 #include "chrome/browser/extensions/standard_management_policy_provider.h"
18 #include "components/prefs/pref_registry_simple.h" 19 #include "components/prefs/pref_registry_simple.h"
19 #include "components/prefs/testing_pref_service.h" 20 #include "components/prefs/testing_pref_service.h"
20 #include "extensions/browser/pref_names.h" 21 #include "extensions/browser/pref_names.h"
21 #include "extensions/common/manifest.h" 22 #include "extensions/common/manifest.h"
22 #include "extensions/common/manifest_constants.h" 23 #include "extensions/common/manifest_constants.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 new StandardManagementPolicyProvider(extension_management_.get())); 259 new StandardManagementPolicyProvider(extension_management_.get()));
259 } 260 }
260 261
261 void CreateExtension(Manifest::Location location) { 262 void CreateExtension(Manifest::Location location) {
262 base::DictionaryValue values; 263 base::DictionaryValue values;
263 CreateExtensionFromValues(location, &values); 264 CreateExtensionFromValues(location, &values);
264 } 265 }
265 266
266 void CreateHostedApp(Manifest::Location location) { 267 void CreateHostedApp(Manifest::Location location) {
267 base::DictionaryValue values; 268 base::DictionaryValue values;
268 values.Set(extensions::manifest_keys::kWebURLs, new base::ListValue()); 269 values.Set(extensions::manifest_keys::kWebURLs,
270 base::MakeUnique<base::ListValue>());
269 values.SetString(extensions::manifest_keys::kLaunchWebURL, 271 values.SetString(extensions::manifest_keys::kLaunchWebURL,
270 "http://www.example.com"); 272 "http://www.example.com");
271 CreateExtensionFromValues(location, &values); 273 CreateExtensionFromValues(location, &values);
272 } 274 }
273 275
274 void CreateExtensionFromValues(Manifest::Location location, 276 void CreateExtensionFromValues(Manifest::Location location,
275 base::DictionaryValue* values) { 277 base::DictionaryValue* values) {
276 values->SetString(extensions::manifest_keys::kName, "test"); 278 values->SetString(extensions::manifest_keys::kName, "test");
277 values->SetString(extensions::manifest_keys::kVersion, "0.1"); 279 values->SetString(extensions::manifest_keys::kVersion, "0.1");
278 std::string error; 280 std::string error;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 EXPECT_FALSE(error.empty()); 936 EXPECT_FALSE(error.empty());
935 937
936 CreateExtension(Manifest::INTERNAL); 938 CreateExtension(Manifest::INTERNAL);
937 error.clear(); 939 error.clear();
938 EXPECT_FALSE(MustRemainEnabled(extension_.get(), NULL)); 940 EXPECT_FALSE(MustRemainEnabled(extension_.get(), NULL));
939 EXPECT_FALSE(MustRemainEnabled(extension_.get(), &error)); 941 EXPECT_FALSE(MustRemainEnabled(extension_.get(), &error));
940 EXPECT_TRUE(error.empty()); 942 EXPECT_TRUE(error.empty());
941 } 943 }
942 944
943 } // namespace extensions 945 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698