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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 std::vector<GURL> urls; | 83 std::vector<GURL> urls; |
84 urls.push_back(test_server()->GetURL("files/page_cycler/basic_html.html")); | 84 urls.push_back(test_server()->GetURL("files/page_cycler/basic_html.html")); |
85 urls.push_back(test_server()->GetURL("files/page_cycler/basic_js.html")); | 85 urls.push_back(test_server()->GetURL("files/page_cycler/basic_js.html")); |
86 urls.push_back(test_server()->GetURL("files/page_cycler/basic_css.html")); | 86 urls.push_back(test_server()->GetURL("files/page_cycler/basic_css.html")); |
87 return urls; | 87 return urls; |
88 } | 88 } |
89 | 89 |
90 // Read the errors file, and generate a vector of error strings. | 90 // Read the errors file, and generate a vector of error strings. |
91 std::vector<std::string> GetErrorsFromFile() { | 91 std::vector<std::string> GetErrorsFromFile() { |
92 std::string error_file_contents; | 92 std::string error_file_contents; |
93 CHECK(file_util::ReadFileToString(errors_file_, | 93 CHECK(base::ReadFileToString(errors_file_, &error_file_contents)); |
94 &error_file_contents)); | |
95 if (error_file_contents[error_file_contents.size() - 1] == '\n') | 94 if (error_file_contents[error_file_contents.size() - 1] == '\n') |
96 error_file_contents.resize(error_file_contents.size() - 1); | 95 error_file_contents.resize(error_file_contents.size() - 1); |
97 | 96 |
98 std::vector<std::string> errors; | 97 std::vector<std::string> errors; |
99 base::SplitString(error_file_contents, '\n', &errors); | 98 base::SplitString(error_file_contents, '\n', &errors); |
100 | 99 |
101 return errors; | 100 return errors; |
102 } | 101 } |
103 | 102 |
104 // Convert a vector of GURLs into a newline-separated string, ready to be | 103 // Convert a vector of GURLs into a newline-separated string, ready to be |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 ASSERT_EQ(1u, errors.size()); | 389 ASSERT_EQ(1u, errors.size()); |
391 | 390 |
392 std::string expected_error; | 391 std::string expected_error; |
393 expected_error.append("Failed to load the page at: ") | 392 expected_error.append("Failed to load the page at: ") |
394 .append(kCacheMissURL) | 393 .append(kCacheMissURL) |
395 .append(": The requested entry was not found in the cache."); | 394 .append(": The requested entry was not found in the cache."); |
396 | 395 |
397 ASSERT_FALSE(errors[0].compare(expected_error)); | 396 ASSERT_FALSE(errors[0].compare(expected_error)); |
398 } | 397 } |
399 #endif // !defined(OS_CHROMEOS) | 398 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |