| OLD | NEW |
| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 base::FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); | 154 base::FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); |
| 155 CHECK(file_util::PathExists(source_data_dir)); | 155 CHECK(file_util::PathExists(source_data_dir)); |
| 156 | 156 |
| 157 CHECK(user_data_dir_.CreateUniqueTempDir()); | 157 CHECK(user_data_dir_.CreateUniqueTempDir()); |
| 158 | 158 |
| 159 base::FilePath dest_data_dir = | 159 base::FilePath dest_data_dir = |
| 160 user_data_dir_.path().AppendASCII("cached_data_dir"); | 160 user_data_dir_.path().AppendASCII("cached_data_dir"); |
| 161 CHECK(!file_util::PathExists(dest_data_dir)); | 161 CHECK(!file_util::PathExists(dest_data_dir)); |
| 162 | 162 |
| 163 CHECK(file_util::CopyDirectory(source_data_dir, | 163 CHECK(base::CopyDirectory(source_data_dir, user_data_dir_.path(), |
| 164 user_data_dir_.path(), | 164 true)); // recursive. |
| 165 true)); // recursive. | |
| 166 CHECK(file_util::PathExists(dest_data_dir)); | 165 CHECK(file_util::PathExists(dest_data_dir)); |
| 167 | 166 |
| 168 command_line->AppendSwitchPath(switches::kUserDataDir, | 167 command_line->AppendSwitchPath(switches::kUserDataDir, |
| 169 dest_data_dir); | 168 dest_data_dir); |
| 170 command_line->AppendSwitch(switches::kPlaybackMode); | 169 command_line->AppendSwitch(switches::kPlaybackMode); |
| 171 } | 170 } |
| 172 | 171 |
| 173 // Initialize the file paths to use the UserDataDir's urls file, instead | 172 // Initialize the file paths to use the UserDataDir's urls file, instead |
| 174 // of one to be written. | 173 // of one to be written. |
| 175 virtual void InitFilePaths(base::FilePath temp_path) OVERRIDE { | 174 virtual void InitFilePaths(base::FilePath temp_path) OVERRIDE { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 ASSERT_EQ(1u, errors.size()); | 390 ASSERT_EQ(1u, errors.size()); |
| 392 | 391 |
| 393 std::string expected_error; | 392 std::string expected_error; |
| 394 expected_error.append("Failed to load the page at: ") | 393 expected_error.append("Failed to load the page at: ") |
| 395 .append(kCacheMissURL) | 394 .append(kCacheMissURL) |
| 396 .append(": The requested entry was not found in the cache."); | 395 .append(": The requested entry was not found in the cache."); |
| 397 | 396 |
| 398 ASSERT_FALSE(errors[0].compare(expected_error)); | 397 ASSERT_FALSE(errors[0].compare(expected_error)); |
| 399 } | 398 } |
| 400 #endif // !defined(OS_CHROMEOS) | 399 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |