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

Side by Side Diff: base/test/scoped_path_override.cc

Issue 2275553005: //base: Make ScopedTempDir::path() a GetPath() with a DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments 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
« no previous file with comments | « base/test/launcher/unit_test_launcher.cc ('k') | base/win/event_trace_consumer_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/test/scoped_path_override.h" 5 #include "base/test/scoped_path_override.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 ScopedPathOverride::ScopedPathOverride(int key) : key_(key) { 12 ScopedPathOverride::ScopedPathOverride(int key) : key_(key) {
13 bool result = temp_dir_.CreateUniqueTempDir(); 13 bool result = temp_dir_.CreateUniqueTempDir();
14 CHECK(result); 14 CHECK(result);
15 result = PathService::Override(key, temp_dir_.path()); 15 result = PathService::Override(key, temp_dir_.GetPath());
16 CHECK(result); 16 CHECK(result);
17 } 17 }
18 18
19 ScopedPathOverride::ScopedPathOverride(int key, const base::FilePath& dir) 19 ScopedPathOverride::ScopedPathOverride(int key, const base::FilePath& dir)
20 : key_(key) { 20 : key_(key) {
21 bool result = PathService::Override(key, dir); 21 bool result = PathService::Override(key, dir);
22 CHECK(result); 22 CHECK(result);
23 } 23 }
24 24
25 ScopedPathOverride::ScopedPathOverride(int key, 25 ScopedPathOverride::ScopedPathOverride(int key,
26 const FilePath& path, 26 const FilePath& path,
27 bool is_absolute, 27 bool is_absolute,
28 bool create) 28 bool create)
29 : key_(key) { 29 : key_(key) {
30 bool result = 30 bool result =
31 PathService::OverrideAndCreateIfNeeded(key, path, is_absolute, create); 31 PathService::OverrideAndCreateIfNeeded(key, path, is_absolute, create);
32 CHECK(result); 32 CHECK(result);
33 } 33 }
34 34
35 ScopedPathOverride::~ScopedPathOverride() { 35 ScopedPathOverride::~ScopedPathOverride() {
36 bool result = PathService::RemoveOverride(key_); 36 bool result = PathService::RemoveOverride(key_);
37 CHECK(result) << "The override seems to have been removed already!"; 37 CHECK(result) << "The override seems to have been removed already!";
38 } 38 }
39 39
40 } // namespace base 40 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/unit_test_launcher.cc ('k') | base/win/event_trace_consumer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698