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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 void DumpAccessibilityTreeTest::RunTest( 124 void DumpAccessibilityTreeTest::RunTest(
125 const base::FilePath::CharType* file_path) { 125 const base::FilePath::CharType* file_path) {
126 NavigateToURL(shell(), GURL("about:blank")); 126 NavigateToURL(shell(), GURL("about:blank"));
127 127
128 // Setup test paths. 128 // Setup test paths.
129 base::FilePath dir_test_data; 129 base::FilePath dir_test_data;
130 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 130 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
131 base::FilePath test_path( 131 base::FilePath test_path(
132 dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); 132 dir_test_data.Append(FILE_PATH_LITERAL("accessibility")));
133 ASSERT_TRUE(file_util::PathExists(test_path)) 133 ASSERT_TRUE(base::PathExists(test_path))
134 << test_path.LossyDisplayName(); 134 << test_path.LossyDisplayName();
135 135
136 base::FilePath html_file = test_path.Append(base::FilePath(file_path)); 136 base::FilePath html_file = test_path.Append(base::FilePath(file_path));
137 // Output the test path to help anyone who encounters a failure and needs 137 // Output the test path to help anyone who encounters a failure and needs
138 // to know where to look. 138 // to know where to look.
139 printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); 139 printf("Testing: %s\n", html_file.MaybeAsASCII().c_str());
140 140
141 std::string html_contents; 141 std::string html_contents;
142 file_util::ReadFileToString(html_file, &html_contents); 142 file_util::ReadFileToString(html_file, &html_contents);
143 143
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ++ diff_index; 209 ++ diff_index;
210 } 210 }
211 printf("%1s %4d %s\n", is_diff? kSignalDiff : "", line + 1, 211 printf("%1s %4d %s\n", is_diff? kSignalDiff : "", line + 1,
212 expected_lines[line].c_str()); 212 expected_lines[line].c_str());
213 } 213 }
214 printf("\nActual\n"); 214 printf("\nActual\n");
215 printf("------\n"); 215 printf("------\n");
216 printf("%s\n", actual_contents.c_str()); 216 printf("%s\n", actual_contents.c_str());
217 } 217 }
218 218
219 if (!file_util::PathExists(expected_file)) { 219 if (!base::PathExists(expected_file)) {
220 base::FilePath actual_file = 220 base::FilePath actual_file =
221 base::FilePath(html_file.RemoveExtension().value() + 221 base::FilePath(html_file.RemoveExtension().value() +
222 AccessibilityTreeFormatter::GetActualFileSuffix()); 222 AccessibilityTreeFormatter::GetActualFileSuffix());
223 223
224 EXPECT_TRUE(file_util::WriteFile( 224 EXPECT_TRUE(file_util::WriteFile(
225 actual_file, actual_contents.c_str(), actual_contents.size())); 225 actual_file, actual_contents.c_str(), actual_contents.size()));
226 226
227 ADD_FAILURE() << "No expectation found. Create it by doing:\n" 227 ADD_FAILURE() << "No expectation found. Create it by doing:\n"
228 << "mv " << actual_file.LossyDisplayName() << " " 228 << "mv " << actual_file.LossyDisplayName() << " "
229 << expected_file.LossyDisplayName(); 229 << expected_file.LossyDisplayName();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 444
445 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) { 445 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) {
446 RunTest(FILE_PATH_LITERAL("ul.html")); 446 RunTest(FILE_PATH_LITERAL("ul.html"));
447 } 447 }
448 448
449 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { 449 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
450 RunTest(FILE_PATH_LITERAL("wbr.html")); 450 RunTest(FILE_PATH_LITERAL("wbr.html"));
451 } 451 }
452 452
453 } // namespace content 453 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698