| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 ++line) { | 175 ++line) { |
| 176 bool is_diff = false; | 176 bool is_diff = false; |
| 177 if (diff_index < static_cast<int>(diff_lines.size()) && | 177 if (diff_index < static_cast<int>(diff_lines.size()) && |
| 178 diff_lines[diff_index] == line) { | 178 diff_lines[diff_index] == line) { |
| 179 is_diff = true; | 179 is_diff = true; |
| 180 ++ diff_index; | 180 ++ diff_index; |
| 181 } | 181 } |
| 182 printf("%1s %4d %s\n", is_diff? kSignalDiff : "", line + 1, | 182 printf("%1s %4d %s\n", is_diff? kSignalDiff : "", line + 1, |
| 183 expected_lines[line].c_str()); | 183 expected_lines[line].c_str()); |
| 184 } | 184 } |
| 185 printf("\n"); | 185 printf("\nActual\n"); |
| 186 printf("------\n"); |
| 187 printf("%s\n", actual_contents.c_str()); |
| 186 } | 188 } |
| 187 | 189 |
| 188 if (!file_util::PathExists(expected_file)) { | 190 if (!file_util::PathExists(expected_file)) { |
| 189 FilePath actual_file = | 191 FilePath actual_file = |
| 190 FilePath(html_file.RemoveExtension().value() + | 192 FilePath(html_file.RemoveExtension().value() + |
| 191 helper_.GetActualFileSuffix()); | 193 helper_.GetActualFileSuffix()); |
| 192 | 194 |
| 193 EXPECT_TRUE(file_util::WriteFile( | 195 EXPECT_TRUE(file_util::WriteFile( |
| 194 actual_file, actual_contents.c_str(), actual_contents.size())); | 196 actual_file, actual_contents.c_str(), actual_contents.size())); |
| 195 | 197 |
| 196 ADD_FAILURE() << "No expectation found. Create it by doing:\n" | 198 ADD_FAILURE() << "No expectation found. Create it by doing:\n" |
| 197 << "mv " << actual_file.LossyDisplayName() << " " | 199 << "mv " << actual_file.LossyDisplayName() << " " |
| 198 << expected_file.LossyDisplayName(); | 200 << expected_file.LossyDisplayName(); |
| 199 } | 201 } |
| 200 } while (!(html_file = file_enumerator.Next()).empty()); | 202 } while (!(html_file = file_enumerator.Next()).empty()); |
| 201 } | 203 } |
| 202 | 204 |
| OLD | NEW |