Implement Tier 2 of Cookie handling for Mirror on WKBling.
[chromium-blink-merge.git] / courgette / base_test_unittest.cc
bloba5537b65a6107fbf67e0dcdabf88f50c16ec68c0
1 // Copyright (c) 2011 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 "courgette/base_test_unittest.h"
7 #include "base/files/file_util.h"
8 #include "base/path_service.h"
10 void BaseTest::SetUp() {
11 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_dir_));
12 test_dir_ = test_dir_.AppendASCII("courgette");
13 test_dir_ = test_dir_.AppendASCII("testdata");
16 void BaseTest::TearDown() {
19 // Reads a test file into a string.
20 std::string BaseTest::FileContents(const char* file_name) const {
21 base::FilePath file_path = test_dir_;
22 file_path = file_path.AppendASCII(file_name);
23 std::string file_bytes;
25 EXPECT_TRUE(base::ReadFileToString(file_path, &file_bytes));
27 return file_bytes;
30 std::string BaseTest::FilesContents(std::list<std::string> file_names) const {
31 std::string result;
33 std::list<std::string>::iterator file_name = file_names.begin();
35 while (file_name != file_names.end()) {
36 result += FileContents(file_name->c_str());
37 file_name++;
40 return result;