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

Side by Side Diff: chrome/browser/extensions/updater/local_extension_cache_unittest.cc

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 years, 3 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/updater/local_extension_cache.h" 5 #include "chrome/browser/extensions/updater/local_extension_cache.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void SetUp() override { 48 void SetUp() override {
49 pool_owner_.reset( 49 pool_owner_.reset(
50 new base::SequencedWorkerPoolOwner(3, "Background Pool")); 50 new base::SequencedWorkerPoolOwner(3, "Background Pool"));
51 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner( 51 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner(
52 pool_owner_->pool()->GetNamedSequenceToken("background")); 52 pool_owner_->pool()->GetNamedSequenceToken("background"));
53 } 53 }
54 54
55 base::FilePath CreateCacheDir(bool initialized) { 55 base::FilePath CreateCacheDir(bool initialized) {
56 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir()); 56 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir());
57 if (initialized) 57 if (initialized)
58 CreateFlagFile(cache_dir_.path()); 58 CreateFlagFile(cache_dir_.GetPath());
59 return cache_dir_.path(); 59 return cache_dir_.GetPath();
60 } 60 }
61 61
62 base::FilePath CreateTempDir() { 62 base::FilePath CreateTempDir() {
63 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 63 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
64 return temp_dir_.path(); 64 return temp_dir_.GetPath();
65 } 65 }
66 66
67 void CreateFlagFile(const base::FilePath& dir) { 67 void CreateFlagFile(const base::FilePath& dir) {
68 CreateFile(dir.Append( 68 CreateFile(dir.Append(
69 extensions::LocalExtensionCache::kCacheReadyFlagFileName), 69 extensions::LocalExtensionCache::kCacheReadyFlagFileName),
70 0, base::Time::Now()); 70 0, base::Time::Now());
71 } 71 }
72 72
73 void CreateExtensionFile(const base::FilePath& dir, 73 void CreateExtensionFile(const base::FilePath& dir,
74 const std::string& id, 74 const std::string& id,
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 CreateExtensionFile(cache_dir, kTestExtensionId3, "0.3", 300, time, &file3); 382 CreateExtensionFile(cache_dir, kTestExtensionId3, "0.3", 300, time, &file3);
383 383
384 CreateFlagFile(cache_dir); 384 CreateFlagFile(cache_dir);
385 385
386 WaitForCompletion(); 386 WaitForCompletion();
387 ASSERT_TRUE(initialized); 387 ASSERT_TRUE(initialized);
388 388
389 // Create and initialize installation source directory. 389 // Create and initialize installation source directory.
390 base::ScopedTempDir temp_dir; 390 base::ScopedTempDir temp_dir;
391 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); 391 EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
392 const base::FilePath temp_path = temp_dir.path(); 392 const base::FilePath temp_path = temp_dir.GetPath();
393 std::string version; 393 std::string version;
394 394
395 // Right now we have two files for the first extension 395 // Right now we have two files for the first extension
396 EXPECT_TRUE(base::PathExists(file11)); 396 EXPECT_TRUE(base::PathExists(file11));
397 EXPECT_TRUE(base::PathExists(file12)); 397 EXPECT_TRUE(base::PathExists(file12));
398 EXPECT_TRUE(base::PathExists(file2)); 398 EXPECT_TRUE(base::PathExists(file2));
399 EXPECT_TRUE(base::PathExists(file3)); 399 EXPECT_TRUE(base::PathExists(file3));
400 400
401 // 1. Cache contains an older version 401 // 1. Cache contains an older version
402 base::FilePath temp1; 402 base::FilePath temp1;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 const base::FilePath hashed2 = 479 const base::FilePath hashed2 =
480 GetExtensionFileName(cache_dir, kTestExtensionId1, "3.0", hash4); 480 GetExtensionFileName(cache_dir, kTestExtensionId1, "3.0", hash4);
481 EXPECT_TRUE(base::PathExists(hashed2)); 481 EXPECT_TRUE(base::PathExists(hashed2));
482 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash4, NULL, NULL)); 482 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash4, NULL, NULL));
483 // Old file kept 483 // Old file kept
484 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash3, NULL, NULL)); 484 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash3, NULL, NULL));
485 EXPECT_TRUE(base::DeleteFile(temp7, false)); 485 EXPECT_TRUE(base::DeleteFile(temp7, false));
486 } 486 }
487 487
488 } // namespace extensions 488 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_prefs.cc ('k') | chrome/browser/extensions/wake_event_page_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698