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

Side by Side Diff: extensions/browser/updater/update_service_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // it with some test files. 176 // it with some test files.
177 base::ScopedTempDir temp_dir; 177 base::ScopedTempDir temp_dir;
178 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 178 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
179 base::FilePath foo_js(FILE_PATH_LITERAL("foo.js")); 179 base::FilePath foo_js(FILE_PATH_LITERAL("foo.js"));
180 base::FilePath bar_html(FILE_PATH_LITERAL("bar/bar.html")); 180 base::FilePath bar_html(FILE_PATH_LITERAL("bar/bar.html"));
181 ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), foo_js, "hello")) 181 ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), foo_js, "hello"))
182 << "Failed to write " << temp_dir.path().value() << "/" << foo_js.value(); 182 << "Failed to write " << temp_dir.path().value() << "/" << foo_js.value();
183 ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), bar_html, "world")); 183 ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), bar_html, "world"));
184 184
185 ExtensionBuilder builder; 185 ExtensionBuilder builder;
186 builder.SetManifest(std::move(DictionaryBuilder() 186 builder.SetManifest(DictionaryBuilder()
187 .Set("name", "Foo") 187 .Set("name", "Foo")
188 .Set("version", "1.0") 188 .Set("version", "1.0")
189 .Set("manifest_version", 2))); 189 .Set("manifest_version", 2)
190 .Build());
190 builder.SetID(crx_file::id_util::GenerateId("whatever")); 191 builder.SetID(crx_file::id_util::GenerateId("whatever"));
191 builder.SetPath(temp_dir.path()); 192 builder.SetPath(temp_dir.path());
192 193
193 scoped_refptr<Extension> extension1(builder.Build()); 194 scoped_refptr<Extension> extension1(builder.Build());
194 195
195 ExtensionRegistry::Get(browser_context())->AddEnabled(extension1); 196 ExtensionRegistry::Get(browser_context())->AddEnabled(extension1);
196 std::vector<std::string> ids; 197 std::vector<std::string> ids;
197 ids.push_back(extension1->id()); 198 ids.push_back(extension1->id());
198 199
199 // Start an update check and verify that the UpdateClient was sent the right 200 // Start an update check and verify that the UpdateClient was sent the right
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 std::vector<FakeExtensionSystem::InstallUpdateRequest>* requests = 246 std::vector<FakeExtensionSystem::InstallUpdateRequest>* requests =
246 extension_system()->install_requests(); 247 extension_system()->install_requests();
247 ASSERT_EQ(1u, requests->size()); 248 ASSERT_EQ(1u, requests->size());
248 EXPECT_EQ(requests->at(0).extension_id, extension1->id()); 249 EXPECT_EQ(requests->at(0).extension_id, extension1->id());
249 EXPECT_NE(requests->at(0).temp_dir.value(), new_version_dir.path().value()); 250 EXPECT_NE(requests->at(0).temp_dir.value(), new_version_dir.path().value());
250 } 251 }
251 252
252 } // namespace 253 } // namespace
253 254
254 } // namespace extensions 255 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698