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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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/scoped_locale.cc ('k') | base/test/scoped_path_override.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_SCOPED_PATH_OVERRIDE_H_
6 #define BASE_TEST_SCOPED_PATH_OVERRIDE_H_
7
8 #include "base/basictypes.h"
9 #include "base/files/scoped_temp_dir.h"
10
11 namespace base {
12
13 class FilePath;
14
15 // Sets a path override on construction, and removes it when the object goes out
16 // of scope. This class is intended to be used by tests that need to override
17 // paths to ensure their overrides are properly handled and reverted when the
18 // scope of the test is left.
19 class ScopedPathOverride {
20 public:
21 // Contructor that initializes the override to a scoped temp directory.
22 explicit ScopedPathOverride(int key);
23
24 // Constructor that would use a path provided by the user.
25 ScopedPathOverride(int key, const FilePath& dir);
26
27 // See PathService::OverrideAndCreateIfNeeded.
28 ScopedPathOverride(int key,
29 const FilePath& path,
30 bool is_absolute,
31 bool create);
32 ~ScopedPathOverride();
33
34 private:
35 int key_;
36 ScopedTempDir temp_dir_;
37
38 DISALLOW_COPY_AND_ASSIGN(ScopedPathOverride);
39 };
40
41 } // namespace base
42
43 #endif // BASE_TEST_SCOPED_PATH_OVERRIDE_H_
OLDNEW
« no previous file with comments | « base/test/scoped_locale.cc ('k') | base/test/scoped_path_override.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698