OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "content/browser/web_contents/web_contents_impl.h" | 6 #include "content/browser/web_contents/web_contents_impl.h" |
7 #include "content/public/test/content_browser_test.h" | 7 #include "content/public/test/content_browser_test.h" |
8 #include "content/public/test/content_browser_test_utils.h" | 8 #include "content/public/test/content_browser_test_utils.h" |
9 #include "content/public/test/test_utils.h" | 9 #include "content/public/test/test_utils.h" |
10 #include "content/shell/browser/shell.h" | 10 #include "content/shell/browser/shell.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/accessibility/ax_node.h" | 12 #include "ui/accessibility/ax_node.h" |
13 #include "ui/accessibility/ax_tree.h" | 13 #include "ui/accessibility/ax_tree.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class AXTreeSnapshotWaiter { | 19 class AXTreeSnapshotWaiter { |
20 public: | 20 public: |
21 AXTreeSnapshotWaiter() : loop_runner_(new MessageLoopRunner()) {} | 21 AXTreeSnapshotWaiter() : loop_runner_(new MessageLoopRunner()) {} |
22 | 22 |
23 void Wait() { | 23 void Wait() { |
24 loop_runner_->Run(); | 24 loop_runner_->Run(); |
25 } | 25 } |
26 | 26 |
27 const SimpleAXTreeUpdate& snapshot() const { return snapshot_; } | 27 const ui::AXTreeUpdate& snapshot() const { return snapshot_; } |
28 | 28 |
29 void ReceiveSnapshot(const SimpleAXTreeUpdate& snapshot) { | 29 void ReceiveSnapshot(const ui::AXTreeUpdate& snapshot) { |
30 snapshot_ = snapshot; | 30 snapshot_ = snapshot; |
31 loop_runner_->Quit(); | 31 loop_runner_->Quit(); |
32 } | 32 } |
33 | 33 |
34 private: | 34 private: |
35 SimpleAXTreeUpdate snapshot_; | 35 ui::AXTreeUpdate snapshot_; |
36 scoped_refptr<MessageLoopRunner> loop_runner_; | 36 scoped_refptr<MessageLoopRunner> loop_runner_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(AXTreeSnapshotWaiter); | 38 DISALLOW_COPY_AND_ASSIGN(AXTreeSnapshotWaiter); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 class SnapshotAXTreeBrowserTest : public ContentBrowserTest { | 43 class SnapshotAXTreeBrowserTest : public ContentBrowserTest { |
44 public: | 44 public: |
45 SnapshotAXTreeBrowserTest() {} | 45 SnapshotAXTreeBrowserTest() {} |
(...skipping 22 matching lines...) Expand all Loading... |
68 ui::AXNode* root = tree.root(); | 68 ui::AXNode* root = tree.root(); |
69 ASSERT_NE(nullptr, root); | 69 ASSERT_NE(nullptr, root); |
70 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->data().role); | 70 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->data().role); |
71 ui::AXNode* group = root->ChildAtIndex(0); | 71 ui::AXNode* group = root->ChildAtIndex(0); |
72 ASSERT_EQ(ui::AX_ROLE_GROUP, group->data().role); | 72 ASSERT_EQ(ui::AX_ROLE_GROUP, group->data().role); |
73 ui::AXNode* button = group->ChildAtIndex(0); | 73 ui::AXNode* button = group->ChildAtIndex(0); |
74 ASSERT_EQ(ui::AX_ROLE_BUTTON, button->data().role); | 74 ASSERT_EQ(ui::AX_ROLE_BUTTON, button->data().role); |
75 } | 75 } |
76 | 76 |
77 } // namespace content | 77 } // namespace content |
OLD | NEW |