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

Side by Side Diff: Source/modules/accessibility/AXObjectTest.cpp

Issue 885163002: [Contextual Search] Check for ARIA widget roles. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed changes to WebAXObject. Created 5 years, 10 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 | « Source/modules/accessibility/AXObject.cpp ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/accessibility/AXObject.h"
7
8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h"
10 #include "core/testing/DummyPageHolder.h"
11 #include <gtest/gtest.h>
12
13 namespace blink {
14
15 class AXObjectTest : public testing::Test {
16 protected:
17 Document& document() { return m_pageHolder->document(); }
18
19 private:
20 virtual void SetUp() override;
21
22 OwnPtr<DummyPageHolder> m_pageHolder;
23 };
24
25 void AXObjectTest::SetUp()
26 {
27 m_pageHolder = DummyPageHolder::create(IntSize(800, 600));
28 }
29
30 TEST_F(AXObjectTest, IsARIAWidget)
31 {
32 String testContent = "<body>"
33 "<span id=\"plain\">plain</span><br>"
34 "<span id=\"button\" role=\"button\">button</span><br>"
35 "<span id=\"button-parent\" role=\"button\"><span>button-parent</span></ span><br>"
36 "<span id=\"button-caps\" role=\"BUTTON\">button-caps</span><br>"
37 "<span id=\"button-second\" role=\"another-role button\">button-second</ span><br>"
38 "<span id=\"aria-bogus\" aria-bogus=\"bogus\">aria-bogus</span><br>"
39 "<span id=\"aria-selected\" aria-selected>aria-selected</span><br>"
40 "<span id=\"haspopup\" aria-haspopup=\"true\">aria-haspopup-true</span>< br>"
41 "<div id=\"focusable\" tabindex=\"1\">focusable</div><br>"
42 "<div tabindex=\"2\"><div id=\"focusable-parent\">focusable-parent</div> </div><br>"
43 "</body>";
44
45 document().documentElement()->setInnerHTML(testContent, ASSERT_NO_EXCEPTION) ;
46 document().updateLayout();
47 Element* root(document().documentElement());
48 EXPECT_FALSE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElemen tById("plain")));
49 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("button")));
50 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("button-parent")));
51 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("button-caps")));
52 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("button-second")));
53 EXPECT_FALSE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElemen tById("aria-bogus")));
54 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("aria-selected")));
55 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("haspopup")));
56 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("focusable")));
57 EXPECT_TRUE(AXObject::isInsideFocusableElementOrARIAWidget(*root->getElement ById("focusable-parent")));
58 }
59
60 }
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXObject.cpp ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698