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

Side by Side Diff: content/browser/accessibility/dump_accessibility_events_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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.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_event_recorder.h" 17 #include "content/browser/accessibility/accessibility_event_recorder.h"
17 #include "content/browser/accessibility/accessibility_tree_formatter.h" 18 #include "content/browser/accessibility/accessibility_tree_formatter.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/common/content_paths.h" 23 #include "content/public/common/content_paths.h"
24 #include "content/public/test/content_browser_test_utils.h"
23 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
24 #include "content/test/accessibility_browser_test_utils.h" 26 #include "content/test/accessibility_browser_test_utils.h"
25 27
26 namespace content { 28 namespace content {
27 29
28 typedef AccessibilityTreeFormatter::Filter Filter; 30 typedef AccessibilityTreeFormatter::Filter Filter;
29 31
30 // Tests that the right platform-specific accessibility events are fired 32 // Tests that the right platform-specific accessibility events are fired
31 // in response to things that happen in a web document. 33 // in response to things that happen in a web document.
32 // 34 //
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 printf("Initial accessibility tree (after load complete):\n"); 134 printf("Initial accessibility tree (after load complete):\n");
133 printf("%s\n", base::UTF16ToUTF8(initial_tree_).c_str()); 135 printf("%s\n", base::UTF16ToUTF8(initial_tree_).c_str());
134 printf("\n"); 136 printf("\n");
135 printf("Final accessibility tree after events fired:\n"); 137 printf("Final accessibility tree after events fired:\n");
136 printf("%s\n", base::UTF16ToUTF8(final_tree_).c_str()); 138 printf("%s\n", base::UTF16ToUTF8(final_tree_).c_str());
137 printf("\n"); 139 printf("\n");
138 } 140 }
139 141
140 void DumpAccessibilityEventsTest::RunEventTest( 142 void DumpAccessibilityEventsTest::RunEventTest(
141 const base::FilePath::CharType* file_path) { 143 const base::FilePath::CharType* file_path) {
142 base::FilePath dir_test_data; 144 base::FilePath test_path = GetTestFilePath("accessibility", "event");
143 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 145
144 base::FilePath test_path(dir_test_data.AppendASCII("accessibility") 146 {
145 .AppendASCII("event")); 147 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_verification;
146 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 148 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
149 }
147 150
148 base::FilePath event_file = test_path.Append(base::FilePath(file_path)); 151 base::FilePath event_file = test_path.Append(base::FilePath(file_path));
149 RunTest(event_file, "accessibility/event"); 152 RunTest(event_file, "accessibility/event");
150 } 153 }
151 154
152 // TODO(dmazzoni): port these tests to run on all platforms. 155 // TODO(dmazzoni): port these tests to run on all platforms.
153 // TODO(crbug.com/617146): All tests flaky on Windows 8. 156 // TODO(crbug.com/617146): All tests flaky on Windows 8.
154 #if /*defined(OS_WIN) ||*/ defined(OS_MACOSX) 157 #if /*defined(OS_WIN) ||*/ defined(OS_MACOSX)
155 158
156 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, 159 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 332 }
330 333
331 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest, 334 IN_PROC_BROWSER_TEST_F(DumpAccessibilityEventsTest,
332 AccessibilityEventsTextChanged) { 335 AccessibilityEventsTextChanged) {
333 RunEventTest(FILE_PATH_LITERAL("text-changed.html")); 336 RunEventTest(FILE_PATH_LITERAL("text-changed.html"));
334 } 337 }
335 338
336 #endif // defined(OS_WIN) 339 #endif // defined(OS_WIN)
337 340
338 } // namespace content 341 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698