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

Side by Side Diff: extensions/common/extension_set_unittest.cc

Issue 2899743002: Remove raw base::DictionaryValue::Set in //extensions (Closed)
Patch Set: Addressed nit Created 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/extension_set.h" 5 #include "extensions/common/extension_set.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 9
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "build/build_config.h" 15 #include "build/build_config.h"
14 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
17 namespace extensions { 19 namespace extensions {
18 20
19 namespace { 21 namespace {
20 22
21 scoped_refptr<Extension> CreateTestExtension(const std::string& name, 23 scoped_refptr<Extension> CreateTestExtension(const std::string& name,
22 const std::string& launch_url, 24 const std::string& launch_url,
23 const std::string& extent) { 25 const std::string& extent) {
24 #if defined(OS_WIN) 26 #if defined(OS_WIN)
25 base::FilePath path(FILE_PATH_LITERAL("c:\\")); 27 base::FilePath path(FILE_PATH_LITERAL("c:\\"));
26 #else 28 #else
27 base::FilePath path(FILE_PATH_LITERAL("/")); 29 base::FilePath path(FILE_PATH_LITERAL("/"));
28 #endif 30 #endif
29 path = path.AppendASCII(name); 31 path = path.AppendASCII(name);
30 32
31 base::DictionaryValue manifest; 33 base::DictionaryValue manifest;
32 manifest.SetString("name", name); 34 manifest.SetString("name", name);
33 manifest.SetString("version", "1"); 35 manifest.SetString("version", "1");
34 36
35 if (!launch_url.empty()) 37 if (!launch_url.empty())
36 manifest.SetString("app.launch.web_url", launch_url); 38 manifest.SetString("app.launch.web_url", launch_url);
37 39
38 if (!extent.empty()) { 40 if (!extent.empty()) {
39 base::ListValue* urls = new base::ListValue(); 41 auto urls = base::MakeUnique<base::ListValue>();
40 manifest.Set("app.urls", urls);
41 urls->AppendString(extent); 42 urls->AppendString(extent);
43 manifest.Set("app.urls", std::move(urls));
42 } 44 }
43 45
44 std::string error; 46 std::string error;
45 scoped_refptr<Extension> extension( 47 scoped_refptr<Extension> extension(
46 Extension::Create(path, Manifest::INTERNAL, manifest, 48 Extension::Create(path, Manifest::INTERNAL, manifest,
47 Extension::NO_FLAGS, &error)); 49 Extension::NO_FLAGS, &error));
48 EXPECT_TRUE(extension.get()) << error; 50 EXPECT_TRUE(extension.get()) << error;
49 return extension; 51 return extension;
50 } 52 }
51 53
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 143
142 ASSERT_TRUE(extensions.Contains(ext3->id())); 144 ASSERT_TRUE(extensions.Contains(ext3->id()));
143 ASSERT_TRUE(extensions.InsertAll(*to_add)); 145 ASSERT_TRUE(extensions.InsertAll(*to_add));
144 EXPECT_EQ(4u, extensions.size()); 146 EXPECT_EQ(4u, extensions.size());
145 147
146 ASSERT_FALSE(extensions.InsertAll(*to_add)); // Re-adding same set no-ops. 148 ASSERT_FALSE(extensions.InsertAll(*to_add)); // Re-adding same set no-ops.
147 EXPECT_EQ(4u, extensions.size()); 149 EXPECT_EQ(4u, extensions.size());
148 } 150 }
149 151
150 } // namespace extensions 152 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_l10n_util_unittest.cc ('k') | extensions/common/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698