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

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

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
« no previous file with comments | « extensions/browser/updater/update_service.h ('k') | extensions/browser/user_script_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 FakeExtensionSystem* extension_system() { 190 FakeExtensionSystem* extension_system() {
191 return static_cast<FakeExtensionSystem*>( 191 return static_cast<FakeExtensionSystem*>(
192 fake_extension_system_factory_.GetForBrowserContext(browser_context())); 192 fake_extension_system_factory_.GetForBrowserContext(browser_context()));
193 } 193 }
194 194
195 private: 195 private:
196 UpdateService* update_service_; 196 UpdateService* update_service_;
197 scoped_refptr<FakeUpdateClient> update_client_; 197 scoped_refptr<FakeUpdateClient> update_client_;
198 scoped_ptr<content::TestBrowserThreadBundle> browser_threads_; 198 std::unique_ptr<content::TestBrowserThreadBundle> browser_threads_;
199 MockExtensionSystemFactory<FakeExtensionSystem> 199 MockExtensionSystemFactory<FakeExtensionSystem>
200 fake_extension_system_factory_; 200 fake_extension_system_factory_;
201 }; 201 };
202 202
203 TEST_F(UpdateServiceTest, BasicUpdateOperations) { 203 TEST_F(UpdateServiceTest, BasicUpdateOperations) {
204 // Create a temporary directory that a fake extension will live in and fill 204 // Create a temporary directory that a fake extension will live in and fill
205 // it with some test files. 205 // it with some test files.
206 base::ScopedTempDir temp_dir; 206 base::ScopedTempDir temp_dir;
207 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 207 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
208 base::FilePath foo_js(FILE_PATH_LITERAL("foo.js")); 208 base::FilePath foo_js(FILE_PATH_LITERAL("foo.js"));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 EXPECT_FALSE(installer->GetInstalledFile("C:\\tmp", &tmp)); 254 EXPECT_FALSE(installer->GetInstalledFile("C:\\tmp", &tmp));
255 255
256 base::FilePath system_temp_dir; 256 base::FilePath system_temp_dir;
257 ASSERT_TRUE(base::GetTempDir(&system_temp_dir)); 257 ASSERT_TRUE(base::GetTempDir(&system_temp_dir));
258 EXPECT_FALSE( 258 EXPECT_FALSE(
259 installer->GetInstalledFile(system_temp_dir.MaybeAsASCII(), &tmp)); 259 installer->GetInstalledFile(system_temp_dir.MaybeAsASCII(), &tmp));
260 260
261 // Test the install callback. 261 // Test the install callback.
262 base::ScopedTempDir new_version_dir; 262 base::ScopedTempDir new_version_dir;
263 ASSERT_TRUE(new_version_dir.CreateUniqueTempDir()); 263 ASSERT_TRUE(new_version_dir.CreateUniqueTempDir());
264 scoped_ptr<base::DictionaryValue> new_manifest( 264 std::unique_ptr<base::DictionaryValue> new_manifest(
265 extension1->manifest()->value()->DeepCopy()); 265 extension1->manifest()->value()->DeepCopy());
266 new_manifest->SetString("version", "2.0"); 266 new_manifest->SetString("version", "2.0");
267 267
268 installer->Install(*new_manifest, new_version_dir.path()); 268 installer->Install(*new_manifest, new_version_dir.path());
269 269
270 scoped_refptr<content::MessageLoopRunner> loop_runner = 270 scoped_refptr<content::MessageLoopRunner> loop_runner =
271 new content::MessageLoopRunner(); 271 new content::MessageLoopRunner();
272 extension_system()->set_install_callback(loop_runner->QuitClosure()); 272 extension_system()->set_install_callback(loop_runner->QuitClosure());
273 loop_runner->Run(); 273 loop_runner->Run();
274 274
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 EXPECT_EQ(*extension3->version(), pings[1].version) << reason; 342 EXPECT_EQ(*extension3->version(), pings[1].version) << reason;
343 EXPECT_EQ(reason, pings[1].reason) << reason; 343 EXPECT_EQ(reason, pings[1].reason) << reason;
344 344
345 pings.clear(); 345 pings.clear();
346 } 346 }
347 } 347 }
348 348
349 } // namespace 349 } // namespace
350 350
351 } // namespace extensions 351 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/updater/update_service.h ('k') | extensions/browser/user_script_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698