| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 "html", GetAttr(tree, WebAccessibility::ATTR_DOC_DOCTYPE).c_str()); | 99 "html", GetAttr(tree, WebAccessibility::ATTR_DOC_DOCTYPE).c_str()); |
| 100 EXPECT_STREQ( | 100 EXPECT_STREQ( |
| 101 "text/html", GetAttr(tree, WebAccessibility::ATTR_DOC_MIMETYPE).c_str()); | 101 "text/html", GetAttr(tree, WebAccessibility::ATTR_DOC_MIMETYPE).c_str()); |
| 102 EXPECT_STREQ("Accessibility Test", UTF16ToUTF8(tree.name).c_str()); | 102 EXPECT_STREQ("Accessibility Test", UTF16ToUTF8(tree.name).c_str()); |
| 103 EXPECT_EQ(WebAccessibility::ROLE_WEB_AREA, tree.role); | 103 EXPECT_EQ(WebAccessibility::ROLE_WEB_AREA, tree.role); |
| 104 | 104 |
| 105 // Check properites of the BODY element. | 105 // Check properites of the BODY element. |
| 106 ASSERT_EQ(1U, tree.children.size()); | 106 ASSERT_EQ(1U, tree.children.size()); |
| 107 const WebAccessibility& body = tree.children[0]; | 107 const WebAccessibility& body = tree.children[0]; |
| 108 EXPECT_EQ(WebAccessibility::ROLE_GROUP, body.role); | 108 EXPECT_EQ(WebAccessibility::ROLE_GROUP, body.role); |
| 109 EXPECT_STREQ("BODY", GetAttr(body, WebAccessibility::ATTR_HTML_TAG).c_str()); | 109 EXPECT_STREQ("body", GetAttr(body, WebAccessibility::ATTR_HTML_TAG).c_str()); |
| 110 EXPECT_STREQ("block", GetAttr(body, WebAccessibility::ATTR_DISPLAY).c_str()); | 110 EXPECT_STREQ("block", GetAttr(body, WebAccessibility::ATTR_DISPLAY).c_str()); |
| 111 | 111 |
| 112 // Check properties of the two children of the BODY element. | 112 // Check properties of the two children of the BODY element. |
| 113 ASSERT_EQ(2U, body.children.size()); | 113 ASSERT_EQ(2U, body.children.size()); |
| 114 | 114 |
| 115 const WebAccessibility& button = body.children[0]; | 115 const WebAccessibility& button = body.children[0]; |
| 116 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button.role); | 116 EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button.role); |
| 117 EXPECT_STREQ( | 117 EXPECT_STREQ( |
| 118 "INPUT", GetAttr(button, WebAccessibility::ATTR_HTML_TAG).c_str()); | 118 "input", GetAttr(button, WebAccessibility::ATTR_HTML_TAG).c_str()); |
| 119 EXPECT_STREQ("push", UTF16ToUTF8(button.name).c_str()); | 119 EXPECT_STREQ("push", UTF16ToUTF8(button.name).c_str()); |
| 120 EXPECT_STREQ( | 120 EXPECT_STREQ( |
| 121 "inline-block", GetAttr(button, WebAccessibility::ATTR_DISPLAY).c_str()); | 121 "inline-block", GetAttr(button, WebAccessibility::ATTR_DISPLAY).c_str()); |
| 122 ASSERT_EQ(2U, button.html_attributes.size()); | 122 ASSERT_EQ(2U, button.html_attributes.size()); |
| 123 EXPECT_STREQ("type", UTF16ToUTF8(button.html_attributes[0].first).c_str()); | 123 EXPECT_STREQ("type", UTF16ToUTF8(button.html_attributes[0].first).c_str()); |
| 124 EXPECT_STREQ("button", UTF16ToUTF8(button.html_attributes[0].second).c_str()); | 124 EXPECT_STREQ("button", UTF16ToUTF8(button.html_attributes[0].second).c_str()); |
| 125 EXPECT_STREQ("value", UTF16ToUTF8(button.html_attributes[1].first).c_str()); | 125 EXPECT_STREQ("value", UTF16ToUTF8(button.html_attributes[1].first).c_str()); |
| 126 EXPECT_STREQ("push", UTF16ToUTF8(button.html_attributes[1].second).c_str()); | 126 EXPECT_STREQ("push", UTF16ToUTF8(button.html_attributes[1].second).c_str()); |
| 127 | 127 |
| 128 const WebAccessibility& checkbox = body.children[1]; | 128 const WebAccessibility& checkbox = body.children[1]; |
| 129 EXPECT_EQ(WebAccessibility::ROLE_CHECKBOX, checkbox.role); | 129 EXPECT_EQ(WebAccessibility::ROLE_CHECKBOX, checkbox.role); |
| 130 EXPECT_STREQ( | 130 EXPECT_STREQ( |
| 131 "INPUT", GetAttr(checkbox, WebAccessibility::ATTR_HTML_TAG).c_str()); | 131 "input", GetAttr(checkbox, WebAccessibility::ATTR_HTML_TAG).c_str()); |
| 132 EXPECT_STREQ( | 132 EXPECT_STREQ( |
| 133 "inline-block", | 133 "inline-block", |
| 134 GetAttr(checkbox, WebAccessibility::ATTR_DISPLAY).c_str()); | 134 GetAttr(checkbox, WebAccessibility::ATTR_DISPLAY).c_str()); |
| 135 ASSERT_EQ(1U, checkbox.html_attributes.size()); | 135 ASSERT_EQ(1U, checkbox.html_attributes.size()); |
| 136 EXPECT_STREQ( | 136 EXPECT_STREQ( |
| 137 "type", UTF16ToUTF8(checkbox.html_attributes[0].first).c_str()); | 137 "type", UTF16ToUTF8(checkbox.html_attributes[0].first).c_str()); |
| 138 EXPECT_STREQ( | 138 EXPECT_STREQ( |
| 139 "checkbox", UTF16ToUTF8(checkbox.html_attributes[0].second).c_str()); | 139 "checkbox", UTF16ToUTF8(checkbox.html_attributes[0].second).c_str()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| OLD | NEW |