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

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

Issue 826323002: Add proper path separator(\) for testing AX test cases on windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 (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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void SetUpCommandLine(base::CommandLine* command_line) override { 59 void SetUpCommandLine(base::CommandLine* command_line) override {
60 ContentBrowserTest::SetUpCommandLine(command_line); 60 ContentBrowserTest::SetUpCommandLine(command_line);
61 // Enable <dialog>, which is used in some tests. 61 // Enable <dialog>, which is used in some tests.
62 base::CommandLine::ForCurrentProcess()->AppendSwitch( 62 base::CommandLine::ForCurrentProcess()->AppendSwitch(
63 switches::kEnableExperimentalWebPlatformFeatures); 63 switches::kEnableExperimentalWebPlatformFeatures);
64 } 64 }
65 65
66 void RunAriaTest(const base::FilePath::CharType* file_path) { 66 void RunAriaTest(const base::FilePath::CharType* file_path) {
67 base::FilePath dir_test_data; 67 base::FilePath dir_test_data;
68 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 68 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
69 base::FilePath test_path( 69
70 dir_test_data.AppendASCII("accessibility/aria")); 70 const char* file_dir = "accessibility/aria";
71 ASSERT_TRUE(base::PathExists(test_path)) 71 #if defined(OS_WIN)
72 << test_path.LossyDisplayName(); 72 file_dir = "accessibility\\aria";
73 #endif
74 base::FilePath test_path(dir_test_data.AppendASCII(file_dir));
75 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
73 76
74 base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); 77 base::FilePath aria_file = test_path.Append(base::FilePath(file_path));
75 RunTest(aria_file, "accessibility/aria"); 78 RunTest(aria_file, file_dir);
76 } 79 }
77 80
78 void RunHtmlTest(const base::FilePath::CharType* file_path) { 81 void RunHtmlTest(const base::FilePath::CharType* file_path) {
79 base::FilePath dir_test_data; 82 base::FilePath dir_test_data;
80 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 83 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
81 base::FilePath test_path( 84
82 dir_test_data.AppendASCII("accessibility/html")); 85 const char* file_dir = "accessibility/html";
83 ASSERT_TRUE(base::PathExists(test_path)) 86 #if defined(OS_WIN)
84 << test_path.LossyDisplayName(); 87 file_dir = "accessibility\\html";
88 #endif
89 base::FilePath test_path(dir_test_data.AppendASCII(file_dir));
90 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
85 91
86 base::FilePath html_file = test_path.Append(base::FilePath(file_path)); 92 base::FilePath html_file = test_path.Append(base::FilePath(file_path));
87 RunTest(html_file, "accessibility/html"); 93 RunTest(html_file, file_dir);
88 } 94 }
89 95
90 std::vector<std::string> Dump() override { 96 std::vector<std::string> Dump() override {
91 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 97 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
92 shell()->web_contents()); 98 shell()->web_contents());
93 AccessibilityTreeFormatter formatter( 99 AccessibilityTreeFormatter formatter(
94 web_contents->GetRootBrowserAccessibilityManager()->GetRoot()); 100 web_contents->GetRootBrowserAccessibilityManager()->GetRoot());
95 formatter.SetFilters(filters_); 101 formatter.SetFilters(filters_);
96 base::string16 actual_contents_utf16; 102 base::string16 actual_contents_utf16;
97 formatter.FormatAccessibilityTree(&actual_contents_utf16); 103 formatter.FormatAccessibilityTree(&actual_contents_utf16);
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 980
975 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityVar) { 981 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityVar) {
976 RunHtmlTest(FILE_PATH_LITERAL("var.html")); 982 RunHtmlTest(FILE_PATH_LITERAL("var.html"));
977 } 983 }
978 984
979 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { 985 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
980 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); 986 RunHtmlTest(FILE_PATH_LITERAL("wbr.html"));
981 } 987 }
982 988
983 } // namespace content 989 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698