naiveproxy/net/test/test_data_directory.cc

49 lines
1.3 KiB
C++
Raw Normal View History

2018-12-10 05:59:24 +03:00
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/test/test_data_directory.h"
#include "base/base_paths.h"
#include "base/path_service.h"
#include "base/threading/thread_restrictions.h"
namespace net {
namespace {
// Net data directory, relative to source root.
const base::FilePath::CharType kNetDataRelativePath[] =
FILE_PATH_LITERAL("net/data");
// Test certificates directory, relative to kNetDataRelativePath.
const base::FilePath::CharType kCertificateDataSubPath[] =
FILE_PATH_LITERAL("ssl/certificates");
} // namespace
base::FilePath GetTestNetDataDirectory() {
base::FilePath src_root;
{
base::ScopedAllowBlockingForTesting allow_blocking;
base::PathService::Get(base::DIR_SOURCE_ROOT, &src_root);
}
return src_root.Append(kNetDataRelativePath);
}
base::FilePath GetTestCertsDirectory() {
return GetTestNetDataDirectory().Append(kCertificateDataSubPath);
}
base::FilePath GetTestClientCertsDirectory() {
return base::FilePath(kNetDataRelativePath).Append(kCertificateDataSubPath);
}
base::FilePath GetWebSocketTestDataDirectory() {
base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket"));
return data_dir;
}
} // namespace net