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

Side by Side Diff: components/test_runner/web_ax_object_proxy.cc

Issue 1336013002: Add test_runner API to set the value of an accessibility object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « components/test_runner/web_ax_object_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/test_runner/web_ax_object_proxy.h" 5 #include "components/test_runner/web_ax_object_proxy.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "gin/handle.h" 8 #include "gin/handle.h"
9 #include "third_party/WebKit/public/platform/WebPoint.h" 9 #include "third_party/WebKit/public/platform/WebPoint.h"
10 #include "third_party/WebKit/public/platform/WebRect.h" 10 #include "third_party/WebKit/public/platform/WebRect.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 &WebAXObjectProxy::IsPressActionSupported) 557 &WebAXObjectProxy::IsPressActionSupported)
558 .SetMethod("isIncrementActionSupported", 558 .SetMethod("isIncrementActionSupported",
559 &WebAXObjectProxy::IsIncrementActionSupported) 559 &WebAXObjectProxy::IsIncrementActionSupported)
560 .SetMethod("isDecrementActionSupported", 560 .SetMethod("isDecrementActionSupported",
561 &WebAXObjectProxy::IsDecrementActionSupported) 561 &WebAXObjectProxy::IsDecrementActionSupported)
562 .SetMethod("parentElement", &WebAXObjectProxy::ParentElement) 562 .SetMethod("parentElement", &WebAXObjectProxy::ParentElement)
563 .SetMethod("increment", &WebAXObjectProxy::Increment) 563 .SetMethod("increment", &WebAXObjectProxy::Increment)
564 .SetMethod("decrement", &WebAXObjectProxy::Decrement) 564 .SetMethod("decrement", &WebAXObjectProxy::Decrement)
565 .SetMethod("showMenu", &WebAXObjectProxy::ShowMenu) 565 .SetMethod("showMenu", &WebAXObjectProxy::ShowMenu)
566 .SetMethod("press", &WebAXObjectProxy::Press) 566 .SetMethod("press", &WebAXObjectProxy::Press)
567 .SetMethod("setValue", &WebAXObjectProxy::SetValue)
567 .SetMethod("isEqual", &WebAXObjectProxy::IsEqual) 568 .SetMethod("isEqual", &WebAXObjectProxy::IsEqual)
568 .SetMethod("setNotificationListener", 569 .SetMethod("setNotificationListener",
569 &WebAXObjectProxy::SetNotificationListener) 570 &WebAXObjectProxy::SetNotificationListener)
570 .SetMethod("unsetNotificationListener", 571 .SetMethod("unsetNotificationListener",
571 &WebAXObjectProxy::UnsetNotificationListener) 572 &WebAXObjectProxy::UnsetNotificationListener)
572 .SetMethod("takeFocus", &WebAXObjectProxy::TakeFocus) 573 .SetMethod("takeFocus", &WebAXObjectProxy::TakeFocus)
573 .SetMethod("scrollToMakeVisible", &WebAXObjectProxy::ScrollToMakeVisible) 574 .SetMethod("scrollToMakeVisible", &WebAXObjectProxy::ScrollToMakeVisible)
574 .SetMethod("scrollToMakeVisibleWithSubFocus", 575 .SetMethod("scrollToMakeVisibleWithSubFocus",
575 &WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus) 576 &WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus)
576 .SetMethod("scrollToGlobalPoint", &WebAXObjectProxy::ScrollToGlobalPoint) 577 .SetMethod("scrollToGlobalPoint", &WebAXObjectProxy::ScrollToGlobalPoint)
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1148
1148 void WebAXObjectProxy::ShowMenu() { 1149 void WebAXObjectProxy::ShowMenu() {
1149 accessibility_object_.showContextMenu(); 1150 accessibility_object_.showContextMenu();
1150 } 1151 }
1151 1152
1152 void WebAXObjectProxy::Press() { 1153 void WebAXObjectProxy::Press() {
1153 accessibility_object_.updateLayoutAndCheckValidity(); 1154 accessibility_object_.updateLayoutAndCheckValidity();
1154 accessibility_object_.press(); 1155 accessibility_object_.press();
1155 } 1156 }
1156 1157
1158 bool WebAXObjectProxy::SetValue(const std::string& value) {
1159 accessibility_object_.updateLayoutAndCheckValidity();
1160 if (!accessibility_object_.canSetValueAttribute())
1161 return false;
1162
1163 accessibility_object_.setValue(blink::WebString::fromUTF8(value));
1164 return true;
1165 }
1166
1157 bool WebAXObjectProxy::IsEqual(v8::Local<v8::Object> proxy) { 1167 bool WebAXObjectProxy::IsEqual(v8::Local<v8::Object> proxy) {
1158 WebAXObjectProxy* unwrapped_proxy = NULL; 1168 WebAXObjectProxy* unwrapped_proxy = NULL;
1159 if (!gin::ConvertFromV8(blink::mainThreadIsolate(), proxy, &unwrapped_proxy)) 1169 if (!gin::ConvertFromV8(blink::mainThreadIsolate(), proxy, &unwrapped_proxy))
1160 return false; 1170 return false;
1161 return unwrapped_proxy->IsEqualToObject(accessibility_object_); 1171 return unwrapped_proxy->IsEqualToObject(accessibility_object_);
1162 } 1172 }
1163 1173
1164 void WebAXObjectProxy::SetNotificationListener( 1174 void WebAXObjectProxy::SetNotificationListener(
1165 v8::Local<v8::Function> callback) { 1175 v8::Local<v8::Function> callback) {
1166 v8::Isolate* isolate = blink::mainThreadIsolate(); 1176 v8::Isolate* isolate = blink::mainThreadIsolate();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 v8::Local<v8::Value> value_handle = gin::CreateHandle( 1347 v8::Local<v8::Value> value_handle = gin::CreateHandle(
1338 isolate, new WebAXObjectProxy(object, this)).ToV8(); 1348 isolate, new WebAXObjectProxy(object, this)).ToV8();
1339 if (value_handle.IsEmpty()) 1349 if (value_handle.IsEmpty())
1340 return v8::Local<v8::Object>(); 1350 return v8::Local<v8::Object>();
1341 v8::Local<v8::Object> handle = value_handle->ToObject(isolate); 1351 v8::Local<v8::Object> handle = value_handle->ToObject(isolate);
1342 elements_.Append(handle); 1352 elements_.Append(handle);
1343 return handle; 1353 return handle;
1344 } 1354 }
1345 1355
1346 } // namespace test_runner 1356 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/web_ax_object_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698