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

Side by Side Diff: content/shell/renderer/test_runner/web_ax_object_proxy.cc

Issue 773133009: Introduce new API Language() to test lang attribute that is properly reported. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « content/shell/renderer/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 "content/shell/renderer/test_runner/web_ax_object_proxy.h" 5 #include "content/shell/renderer/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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::string GetTitle(const blink::WebAXObject& object) { 289 std::string GetTitle(const blink::WebAXObject& object) {
290 std::string title = object.title().utf8(); 290 std::string title = object.title().utf8();
291 return title.insert(0, "AXTitle: "); 291 return title.insert(0, "AXTitle: ");
292 } 292 }
293 293
294 std::string GetValueDescription(const blink::WebAXObject& object) { 294 std::string GetValueDescription(const blink::WebAXObject& object) {
295 std::string value_description = object.valueDescription().utf8(); 295 std::string value_description = object.valueDescription().utf8();
296 return value_description.insert(0, "AXValueDescription: "); 296 return value_description.insert(0, "AXValueDescription: ");
297 } 297 }
298 298
299 std::string GetLanguage(const blink::WebAXObject& object) {
300 std::string language = object.language().utf8();
301 return language.insert(0, "AXLanguage: ");
302 }
303
299 std::string GetAttributes(const blink::WebAXObject& object) { 304 std::string GetAttributes(const blink::WebAXObject& object) {
300 // FIXME: Concatenate all attributes of the AXObject. 305 // FIXME: Concatenate all attributes of the AXObject.
301 std::string attributes(GetTitle(object)); 306 std::string attributes(GetTitle(object));
302 attributes.append("\n"); 307 attributes.append("\n");
303 attributes.append(GetRole(object)); 308 attributes.append(GetRole(object));
304 attributes.append("\n"); 309 attributes.append("\n");
305 attributes.append(GetDescription(object)); 310 attributes.append(GetDescription(object));
306 return attributes; 311 return attributes;
307 } 312 }
308 313
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 WebAXObjectProxy::~WebAXObjectProxy() {} 466 WebAXObjectProxy::~WebAXObjectProxy() {}
462 467
463 gin::ObjectTemplateBuilder 468 gin::ObjectTemplateBuilder
464 WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) { 469 WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) {
465 return gin::Wrappable<WebAXObjectProxy>::GetObjectTemplateBuilder(isolate) 470 return gin::Wrappable<WebAXObjectProxy>::GetObjectTemplateBuilder(isolate)
466 .SetProperty("role", &WebAXObjectProxy::Role) 471 .SetProperty("role", &WebAXObjectProxy::Role)
467 .SetProperty("title", &WebAXObjectProxy::Title) 472 .SetProperty("title", &WebAXObjectProxy::Title)
468 .SetProperty("description", &WebAXObjectProxy::Description) 473 .SetProperty("description", &WebAXObjectProxy::Description)
469 .SetProperty("helpText", &WebAXObjectProxy::HelpText) 474 .SetProperty("helpText", &WebAXObjectProxy::HelpText)
470 .SetProperty("stringValue", &WebAXObjectProxy::StringValue) 475 .SetProperty("stringValue", &WebAXObjectProxy::StringValue)
476 .SetProperty("language", &WebAXObjectProxy::Language)
471 .SetProperty("x", &WebAXObjectProxy::X) 477 .SetProperty("x", &WebAXObjectProxy::X)
472 .SetProperty("y", &WebAXObjectProxy::Y) 478 .SetProperty("y", &WebAXObjectProxy::Y)
473 .SetProperty("width", &WebAXObjectProxy::Width) 479 .SetProperty("width", &WebAXObjectProxy::Width)
474 .SetProperty("height", &WebAXObjectProxy::Height) 480 .SetProperty("height", &WebAXObjectProxy::Height)
475 .SetProperty("intValue", &WebAXObjectProxy::IntValue) 481 .SetProperty("intValue", &WebAXObjectProxy::IntValue)
476 .SetProperty("minValue", &WebAXObjectProxy::MinValue) 482 .SetProperty("minValue", &WebAXObjectProxy::MinValue)
477 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue) 483 .SetProperty("maxValue", &WebAXObjectProxy::MaxValue)
478 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription) 484 .SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription)
479 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount) 485 .SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount)
480 .SetProperty("insertionPointLineNumber", 486 .SetProperty("insertionPointLineNumber",
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 std::string WebAXObjectProxy::HelpText() { 612 std::string WebAXObjectProxy::HelpText() {
607 accessibility_object_.updateLayoutAndCheckValidity(); 613 accessibility_object_.updateLayoutAndCheckValidity();
608 return GetHelpText(accessibility_object_); 614 return GetHelpText(accessibility_object_);
609 } 615 }
610 616
611 std::string WebAXObjectProxy::StringValue() { 617 std::string WebAXObjectProxy::StringValue() {
612 accessibility_object_.updateLayoutAndCheckValidity(); 618 accessibility_object_.updateLayoutAndCheckValidity();
613 return GetStringValue(accessibility_object_); 619 return GetStringValue(accessibility_object_);
614 } 620 }
615 621
622 std::string WebAXObjectProxy::Language() {
623 accessibility_object_.updateLayoutAndCheckValidity();
624 return GetLanguage(accessibility_object_);
625 }
626
616 int WebAXObjectProxy::X() { 627 int WebAXObjectProxy::X() {
617 accessibility_object_.updateLayoutAndCheckValidity(); 628 accessibility_object_.updateLayoutAndCheckValidity();
618 return accessibility_object_.boundingBoxRect().x; 629 return accessibility_object_.boundingBoxRect().x;
619 } 630 }
620 631
621 int WebAXObjectProxy::Y() { 632 int WebAXObjectProxy::Y() {
622 accessibility_object_.updateLayoutAndCheckValidity(); 633 accessibility_object_.updateLayoutAndCheckValidity();
623 return accessibility_object_.boundingBoxRect().y; 634 return accessibility_object_.boundingBoxRect().y;
624 } 635 }
625 636
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 v8::Handle<v8::Value> value_handle = gin::CreateHandle( 1107 v8::Handle<v8::Value> value_handle = gin::CreateHandle(
1097 isolate, new RootWebAXObjectProxy(object, this)).ToV8(); 1108 isolate, new RootWebAXObjectProxy(object, this)).ToV8();
1098 if (value_handle.IsEmpty()) 1109 if (value_handle.IsEmpty())
1099 return v8::Handle<v8::Object>(); 1110 return v8::Handle<v8::Object>();
1100 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate); 1111 v8::Handle<v8::Object> handle = value_handle->ToObject(isolate);
1101 elements_.Append(handle); 1112 elements_.Append(handle);
1102 return handle; 1113 return handle;
1103 } 1114 }
1104 1115
1105 } // namespace content 1116 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/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