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

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

Issue 2175933002: More aggressive IO asserts in content_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 1 less instance of ScopedAllowIO in DumpAccessibilityTestBase::RunTestForPlatform. Created 4 years, 4 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"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_restrictions.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "content/browser/accessibility/accessibility_tree_formatter.h" 17 #include "content/browser/accessibility/accessibility_tree_formatter.h"
17 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" 18 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
18 #include "content/browser/accessibility/browser_accessibility.h" 19 #include "content/browser/accessibility/browser_accessibility.h"
19 #include "content/browser/accessibility/browser_accessibility_manager.h" 20 #include "content/browser/accessibility/browser_accessibility_manager.h"
20 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h" 21 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h"
21 #include "content/browser/web_contents/web_contents_impl.h" 22 #include "content/browser/web_contents/web_contents_impl.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/content_paths.h" 24 #include "content/public/common/content_paths.h"
24 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "content/public/test/content_browser_test_utils.h"
25 #include "content/shell/browser/shell.h" 27 #include "content/shell/browser/shell.h"
26 #include "content/test/accessibility_browser_test_utils.h" 28 #include "content/test/accessibility_browser_test_utils.h"
27 29
28 #if defined(OS_MACOSX) 30 #if defined(OS_MACOSX)
29 #include "base/mac/mac_util.h" 31 #include "base/mac/mac_util.h"
30 #endif 32 #endif
31 33
32 // TODO(aboxhall): Create expectations on Android for these 34 // TODO(aboxhall): Create expectations on Android for these
33 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
34 #define MAYBE(x) DISABLED_##x 36 #define MAYBE(x) DISABLED_##x
(...skipping 27 matching lines...) Expand all
62 } 64 }
63 65
64 void SetUpCommandLine(base::CommandLine* command_line) override { 66 void SetUpCommandLine(base::CommandLine* command_line) override {
65 DumpAccessibilityTestBase::SetUpCommandLine(command_line); 67 DumpAccessibilityTestBase::SetUpCommandLine(command_line);
66 // Enable <dialog>, which is used in some tests. 68 // Enable <dialog>, which is used in some tests.
67 base::CommandLine::ForCurrentProcess()->AppendSwitch( 69 base::CommandLine::ForCurrentProcess()->AppendSwitch(
68 switches::kEnableExperimentalWebPlatformFeatures); 70 switches::kEnableExperimentalWebPlatformFeatures);
69 } 71 }
70 72
71 void RunAriaTest(const base::FilePath::CharType* file_path) { 73 void RunAriaTest(const base::FilePath::CharType* file_path) {
72 base::FilePath dir_test_data; 74 base::FilePath test_path = GetTestFilePath("accessibility", "aria");
73 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 75 {
74 base::FilePath test_path(dir_test_data.AppendASCII("accessibility") 76 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
75 .AppendASCII("aria")); 77 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
76 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 78 }
79 base::FilePath aria_file = test_path.Append(base::FilePath(file_path));
77 80
78 base::FilePath aria_file = test_path.Append(base::FilePath(file_path));
79 RunTest(aria_file, "accessibility/aria"); 81 RunTest(aria_file, "accessibility/aria");
80 } 82 }
81 83
82 void RunCSSTest(const base::FilePath::CharType* file_path) { 84 void RunCSSTest(const base::FilePath::CharType* file_path) {
83 base::FilePath dir_test_data; 85 base::FilePath test_path = GetTestFilePath("accessibility", "css");
84 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 86 {
85 base::FilePath test_path( 87 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
86 dir_test_data.AppendASCII("accessibility").AppendASCII("css")); 88 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
87 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 89 }
90 base::FilePath css_file = test_path.Append(base::FilePath(file_path));
88 91
89 base::FilePath css_file = test_path.Append(base::FilePath(file_path));
90 RunTest(css_file, "accessibility/css"); 92 RunTest(css_file, "accessibility/css");
91 } 93 }
92 94
93 void RunHtmlTest(const base::FilePath::CharType* file_path) { 95 void RunHtmlTest(const base::FilePath::CharType* file_path) {
94 base::FilePath dir_test_data; 96 base::FilePath test_path = GetTestFilePath("accessibility", "html");
95 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 97 {
96 base::FilePath test_path(dir_test_data.AppendASCII("accessibility") 98 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
97 .AppendASCII("html")); 99 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
98 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 100 }
101 base::FilePath html_file = test_path.Append(base::FilePath(file_path));
99 102
100 base::FilePath html_file = test_path.Append(base::FilePath(file_path));
101 RunTest(html_file, "accessibility/html"); 103 RunTest(html_file, "accessibility/html");
102 } 104 }
103 105
104 std::vector<std::string> Dump() override { 106 std::vector<std::string> Dump() override {
105 std::unique_ptr<AccessibilityTreeFormatter> formatter( 107 std::unique_ptr<AccessibilityTreeFormatter> formatter(
106 CreateAccessibilityTreeFormatter()); 108 CreateAccessibilityTreeFormatter());
107 formatter->SetFilters(filters_); 109 formatter->SetFilters(filters_);
108 base::string16 actual_contents_utf16; 110 base::string16 actual_contents_utf16;
109 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 111 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
110 shell()->web_contents()); 112 shell()->web_contents());
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 // crbug.com/281952 1352 // crbug.com/281952
1351 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) { 1353 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) {
1352 RunHtmlTest(FILE_PATH_LITERAL("video.html")); 1354 RunHtmlTest(FILE_PATH_LITERAL("video.html"));
1353 } 1355 }
1354 1356
1355 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { 1357 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
1356 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); 1358 RunHtmlTest(FILE_PATH_LITERAL("wbr.html"));
1357 } 1359 }
1358 1360
1359 } // namespace content 1361 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698