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.
5 #include "base/test/scoped_path_override.h"
7 #include "base/logging.h"
8 #include "base/path_service.h"
12 ScopedPathOverride::ScopedPathOverride(int key
) : key_(key
) {
13 bool result
= temp_dir_
.CreateUniqueTempDir();
15 result
= PathService::Override(key
, temp_dir_
.path());
19 ScopedPathOverride::ScopedPathOverride(int key
, const base::FilePath
& dir
)
21 bool result
= PathService::Override(key
, dir
);
25 ScopedPathOverride::~ScopedPathOverride() {
26 bool result
= PathService::RemoveOverride(key_
);
27 CHECK(result
) << "The override seems to have been removed already!";