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

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

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 (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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/win/scoped_bstr.h" 10 #include "base/win/scoped_bstr.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 // Retrieve the MSAA client accessibility object for the Render Widget Host View 103 // Retrieve the MSAA client accessibility object for the Render Widget Host View
104 // of the selected tab. 104 // of the selected tab.
105 IAccessible* AccessibilityWinBrowserTest::GetRendererAccessible() { 105 IAccessible* AccessibilityWinBrowserTest::GetRendererAccessible() {
106 content::WebContents* web_contents = shell()->web_contents(); 106 content::WebContents* web_contents = shell()->web_contents();
107 return web_contents->GetRenderWidgetHostView()->GetNativeViewAccessible(); 107 return web_contents->GetRenderWidgetHostView()->GetNativeViewAccessible();
108 } 108 }
109 109
110 void AccessibilityWinBrowserTest::ExecuteScript(const std::wstring& script) { 110 void AccessibilityWinBrowserTest::ExecuteScript(const std::wstring& script) {
111 shell()->web_contents()->GetMainFrame()->ExecuteJavaScript(script); 111 shell()->web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(script);
112 } 112 }
113 113
114 // Loads a page with an input text field and places sample text in it. Also, 114 // Loads a page with an input text field and places sample text in it. Also,
115 // places the caret on the last character. 115 // places the caret on the last character.
116 void AccessibilityWinBrowserTest::SetUpInputField( 116 void AccessibilityWinBrowserTest::SetUpInputField(
117 base::win::ScopedComPtr<IAccessibleText>* input_text) { 117 base::win::ScopedComPtr<IAccessibleText>* input_text) {
118 ASSERT_NE(nullptr, input_text); 118 ASSERT_NE(nullptr, input_text);
119 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>" 119 LoadInitialAccessibilityTreeFromHtml(std::string("<!DOCTYPE html><html><body>"
120 "<form><label for='textField'>Browser name:</label>" 120 "<form><label for='textField'>Browser name:</label>"
121 "<input type='text' id='textField' name='name' value='") + 121 "<input type='text' id='textField' name='name' value='") +
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, 1461 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
1462 TestMultiLineTextAtOffsetWithBoundaryAll) { 1462 TestMultiLineTextAtOffsetWithBoundaryAll) {
1463 base::win::ScopedComPtr<IAccessibleText> textarea_text; 1463 base::win::ScopedComPtr<IAccessibleText> textarea_text;
1464 SetUpTextareaField(&textarea_text); 1464 SetUpTextareaField(&textarea_text);
1465 1465
1466 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL, 1466 CheckTextAtOffset(textarea_text, CONTENTS_LENGTH - 1, IA2_TEXT_BOUNDARY_ALL,
1467 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS)); 1467 0, CONTENTS_LENGTH, base::SysUTF8ToWide(TEXTAREA_CONTENTS));
1468 } 1468 }
1469 1469
1470 } // namespace content 1470 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698