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 "chrome/browser/extensions/api/record/record_api.h" | 5 #include "chrome/browser/extensions/api/record/record_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 base::FilePath error_file_path = url_path.DirName(). | 119 base::FilePath error_file_path = url_path.DirName(). |
120 Append(url_path.BaseName().value() + | 120 Append(url_path.BaseName().value() + |
121 base::FilePath::StringType(kURLErrorsSuffix)); | 121 base::FilePath::StringType(kURLErrorsSuffix)); |
122 | 122 |
123 LOG(ERROR) << "Test browser commandline: " << line.GetCommandLineString() << | 123 LOG(ERROR) << "Test browser commandline: " << line.GetCommandLineString() << |
124 " will be repeated " << repeat_count_ << " times...."; | 124 " will be repeated " << repeat_count_ << " times...."; |
125 | 125 |
126 // Run the test browser (or a mockup, depending on |process_strategy_|. | 126 // Run the test browser (or a mockup, depending on |process_strategy_|. |
127 while (repeat_count_-- && errors_.empty() && | 127 while (repeat_count_-- && errors_.empty() && |
128 !file_util::PathExists(error_file_path)) | 128 !base::PathExists(error_file_path)) |
129 process_strategy_->RunProcess(line, &errors_); | 129 process_strategy_->RunProcess(line, &errors_); |
130 | 130 |
131 // Read URL errors file if there is one, and save errors in |errors_|. | 131 // Read URL errors file if there is one, and save errors in |errors_|. |
132 // Odd extension handling needed because temp files have lots of "."s in | 132 // Odd extension handling needed because temp files have lots of "."s in |
133 // their names, and we need to cleanly add kURLErrorsSuffix as a final | 133 // their names, and we need to cleanly add kURLErrorsSuffix as a final |
134 // extension. | 134 // extension. |
135 if (errors_.empty() && file_util::PathExists(error_file_path)) { | 135 if (errors_.empty() && base::PathExists(error_file_path)) { |
136 std::string error_content; | 136 std::string error_content; |
137 file_util::ReadFileToString(error_file_path, &error_content); | 137 file_util::ReadFileToString(error_file_path, &error_content); |
138 | 138 |
139 base::SplitString(error_content, '\n', &errors_); | 139 base::SplitString(error_content, '\n', &errors_); |
140 } | 140 } |
141 | 141 |
142 // Do any special post-test-browser file reading (e.g. stats report)) | 142 // Do any special post-test-browser file reading (e.g. stats report)) |
143 // while we're on the BlockingPool thread. | 143 // while we're on the BlockingPool thread. |
144 ReadReplyFiles(); | 144 ReadReplyFiles(); |
145 | 145 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 result.run_time = run_time_ms_; | 252 result.run_time = run_time_ms_; |
253 result.stats = stats_; | 253 result.stats = stats_; |
254 result.errors = errors_; | 254 result.errors = errors_; |
255 | 255 |
256 results_ = record::ReplayURLs::Results::Create(result); | 256 results_ = record::ReplayURLs::Results::Create(result); |
257 SendResponse(true); | 257 SendResponse(true); |
258 } | 258 } |
259 | 259 |
260 } // namespace extensions | 260 } // namespace extensions |
OLD | NEW |