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

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

Issue 1417353006: Tests: Simplify SequencedWorkerPoolOwner, call Shutdown on destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjust formatting and rebase Created 5 years 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
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 30 matching lines...) Expand all
41 } 41 }
42 42
43 // testing::Test overrides: 43 // testing::Test overrides:
44 void SetUp() override { 44 void SetUp() override {
45 pool_owner_.reset( 45 pool_owner_.reset(
46 new base::SequencedWorkerPoolOwner(3, "Background Pool")); 46 new base::SequencedWorkerPoolOwner(3, "Background Pool"));
47 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner( 47 background_task_runner_ = pool_owner_->pool()->GetSequencedTaskRunner(
48 pool_owner_->pool()->GetNamedSequenceToken("background")); 48 pool_owner_->pool()->GetNamedSequenceToken("background"));
49 } 49 }
50 50
51 void TearDown() override {
52 pool_owner_->pool()->Shutdown();
53 base::RunLoop().RunUntilIdle();
54 }
55
56 base::FilePath CreateCacheDir(bool initialized) { 51 base::FilePath CreateCacheDir(bool initialized) {
57 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir()); 52 EXPECT_TRUE(cache_dir_.CreateUniqueTempDir());
58 if (initialized) 53 if (initialized)
59 CreateFlagFile(cache_dir_.path()); 54 CreateFlagFile(cache_dir_.path());
60 return cache_dir_.path(); 55 return cache_dir_.path();
61 } 56 }
62 57
63 base::FilePath CreateTempDir() { 58 base::FilePath CreateTempDir() {
64 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 59 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
65 return temp_dir_.path(); 60 return temp_dir_.path();
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 const base::FilePath hashed2 = 476 const base::FilePath hashed2 =
482 GetExtensionFileName(cache_dir, kTestExtensionId1, "3.0", hash4); 477 GetExtensionFileName(cache_dir, kTestExtensionId1, "3.0", hash4);
483 EXPECT_TRUE(base::PathExists(hashed2)); 478 EXPECT_TRUE(base::PathExists(hashed2));
484 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash4, NULL, NULL)); 479 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash4, NULL, NULL));
485 // Old file kept 480 // Old file kept
486 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash3, NULL, NULL)); 481 EXPECT_TRUE(cache.GetExtension(kTestExtensionId1, hash3, NULL, NULL));
487 EXPECT_TRUE(base::DeleteFile(temp7, false)); 482 EXPECT_TRUE(base::DeleteFile(temp7, false));
488 } 483 }
489 484
490 } // namespace extensions 485 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698