Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: content/browser/accessibility/dump_accessibility_browsertest_base.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/accessibility/dump_accessibility_browsertest_base.h" 5 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 std::vector<std::string> actual_lines = Dump(); 195 std::vector<std::string> actual_lines = Dump();
196 196
197 // Perform a diff (or write the initial baseline). 197 // Perform a diff (or write the initial baseline).
198 std::vector<std::string> expected_lines = base::SplitString( 198 std::vector<std::string> expected_lines = base::SplitString(
199 expected_contents, "\n", base::KEEP_WHITESPACE, 199 expected_contents, "\n", base::KEEP_WHITESPACE,
200 base::SPLIT_WANT_NONEMPTY); 200 base::SPLIT_WANT_NONEMPTY);
201 // Marking the end of the file with a line of text ensures that 201 // Marking the end of the file with a line of text ensures that
202 // file length differences are found. 202 // file length differences are found.
203 expected_lines.push_back(kMarkEndOfFile); 203 expected_lines.push_back(kMarkEndOfFile);
204 actual_lines.push_back(kMarkEndOfFile); 204 actual_lines.push_back(kMarkEndOfFile);
205 std::string actual_contents = JoinString(actual_lines, "\n"); 205 std::string actual_contents = base::JoinString(actual_lines, "\n");
206 206
207 std::vector<int> diff_lines = DiffLines(expected_lines, actual_lines); 207 std::vector<int> diff_lines = DiffLines(expected_lines, actual_lines);
208 bool is_different = diff_lines.size() > 0; 208 bool is_different = diff_lines.size() > 0;
209 EXPECT_FALSE(is_different); 209 EXPECT_FALSE(is_different);
210 if (is_different) { 210 if (is_different) {
211 OnDiffFailed(); 211 OnDiffFailed();
212 212
213 // Mark the expected lines which did not match actual output with a *. 213 // Mark the expected lines which did not match actual output with a *.
214 printf("* Line Expected\n"); 214 printf("* Line Expected\n");
215 printf("- ---- --------\n"); 215 printf("- ---- --------\n");
(...skipping 22 matching lines...) Expand all
238 EXPECT_TRUE(base::WriteFile( 238 EXPECT_TRUE(base::WriteFile(
239 actual_file, actual_contents.c_str(), actual_contents.size())); 239 actual_file, actual_contents.c_str(), actual_contents.size()));
240 240
241 ADD_FAILURE() << "No expectation found. Create it by doing:\n" 241 ADD_FAILURE() << "No expectation found. Create it by doing:\n"
242 << "mv " << actual_file.LossyDisplayName() << " " 242 << "mv " << actual_file.LossyDisplayName() << " "
243 << expected_file.LossyDisplayName(); 243 << expected_file.LossyDisplayName();
244 } 244 }
245 } 245 }
246 246
247 } // namespace content 247 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698