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

Side by Side Diff: content/browser/accessibility/cross_platform_accessibility_browsertest.cc

Issue 2832023002: Replace SetUpInProcessBrowserTestFixture/TearDownInProcessBrowserTestFixture usage in content with … (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | content/browser/speech/speech_recognition_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Make sure each node in the tree has a unique id. 57 // Make sure each node in the tree has a unique id.
58 void RecursiveAssertUniqueIds( 58 void RecursiveAssertUniqueIds(
59 const ui::AXNode* node, base::hash_set<int>* ids) { 59 const ui::AXNode* node, base::hash_set<int>* ids) {
60 ASSERT_TRUE(ids->find(node->id()) == ids->end()); 60 ASSERT_TRUE(ids->find(node->id()) == ids->end());
61 ids->insert(node->id()); 61 ids->insert(node->id());
62 for (int i = 0; i < node->child_count(); i++) 62 for (int i = 0; i < node->child_count(); i++)
63 RecursiveAssertUniqueIds(node->ChildAtIndex(i), ids); 63 RecursiveAssertUniqueIds(node->ChildAtIndex(i), ids);
64 } 64 }
65 65
66 // ContentBrowserTest 66 // ContentBrowserTest
67 void SetUpInProcessBrowserTestFixture() override; 67 void SetUpOnMainThread() override;
68 void TearDownInProcessBrowserTestFixture() override; 68 void TearDownOnMainThread() override;
69 69
70 protected: 70 protected:
71 std::string GetAttr(const ui::AXNode* node, 71 std::string GetAttr(const ui::AXNode* node,
72 const ui::AXStringAttribute attr); 72 const ui::AXStringAttribute attr);
73 int GetIntAttr(const ui::AXNode* node, 73 int GetIntAttr(const ui::AXNode* node,
74 const ui::AXIntAttribute attr); 74 const ui::AXIntAttribute attr);
75 bool GetBoolAttr(const ui::AXNode* node, 75 bool GetBoolAttr(const ui::AXNode* node,
76 const ui::AXBoolAttribute attr); 76 const ui::AXBoolAttribute attr);
77 77
78 private: 78 private:
79 #if defined(OS_WIN) 79 #if defined(OS_WIN)
80 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer_; 80 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer_;
81 #endif 81 #endif
82 82
83 DISALLOW_COPY_AND_ASSIGN(CrossPlatformAccessibilityBrowserTest); 83 DISALLOW_COPY_AND_ASSIGN(CrossPlatformAccessibilityBrowserTest);
84 }; 84 };
85 85
86 void CrossPlatformAccessibilityBrowserTest::SetUpInProcessBrowserTestFixture() { 86 void CrossPlatformAccessibilityBrowserTest::SetUpOnMainThread() {
87 #if defined(OS_WIN) 87 #if defined(OS_WIN)
88 ui::win::CreateATLModuleIfNeeded(); 88 ui::win::CreateATLModuleIfNeeded();
89 com_initializer_.reset(new base::win::ScopedCOMInitializer()); 89 com_initializer_.reset(new base::win::ScopedCOMInitializer());
90 #endif 90 #endif
91 } 91 }
92 92
93 void 93 void CrossPlatformAccessibilityBrowserTest::TearDownOnMainThread() {
94 CrossPlatformAccessibilityBrowserTest::TearDownInProcessBrowserTestFixture() {
95 #if defined(OS_WIN) 94 #if defined(OS_WIN)
96 com_initializer_.reset(); 95 com_initializer_.reset();
97 #endif 96 #endif
98 } 97 }
99 98
100 // Convenience method to get the value of a particular AXNode 99 // Convenience method to get the value of a particular AXNode
101 // attribute as a UTF-8 string. 100 // attribute as a UTF-8 string.
102 std::string CrossPlatformAccessibilityBrowserTest::GetAttr( 101 std::string CrossPlatformAccessibilityBrowserTest::GetAttr(
103 const ui::AXNode* node, 102 const ui::AXNode* node,
104 const ui::AXStringAttribute attr) { 103 const ui::AXStringAttribute attr) {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 GURL url(url_str); 490 GURL url(url_str);
492 NavigateToURL(shell(), url); 491 NavigateToURL(shell(), url);
493 const ui::AXTree& tree = GetAXTree(); 492 const ui::AXTree& tree = GetAXTree();
494 const ui::AXNode* root = tree.root(); 493 const ui::AXNode* root = tree.root();
495 ASSERT_EQ(1, root->child_count()); 494 ASSERT_EQ(1, root->child_count());
496 const ui::AXNode* textbox = root->ChildAtIndex(0); 495 const ui::AXNode* textbox = root->ChildAtIndex(0);
497 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); 496 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE));
498 } 497 }
499 498
500 } // namespace content 499 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/speech/speech_recognition_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698