| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 Widget::InitParams init_params(Widget::InitParams::TYPE_POPUP); | 58 Widget::InitParams init_params(Widget::InitParams::TYPE_POPUP); |
| 59 init_params.parent = CurrentContext(); | 59 init_params.parent = CurrentContext(); |
| 60 widget_->Init(init_params); | 60 widget_->Init(init_params); |
| 61 | 61 |
| 62 content_ = new View(); | 62 content_ = new View(); |
| 63 widget_->SetContentsView(content_); | 63 widget_->SetContentsView(content_); |
| 64 | 64 |
| 65 textfield_ = new Textfield(); | 65 textfield_ = new Textfield(); |
| 66 textfield_->SetText(base::ASCIIToUTF16("Value")); | 66 textfield_->SetText(base::ASCIIToUTF16("Value")); |
| 67 content_->AddChildView(textfield_); | 67 content_->AddChildView(textfield_); |
| 68 widget_->Show(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 Widget* widget_; | 72 Widget* widget_; |
| 72 View* content_; | 73 View* content_; |
| 73 Textfield* textfield_; | 74 Textfield* textfield_; |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAuraTest); | 77 DISALLOW_COPY_AND_ASSIGN(AXTreeSourceAuraTest); |
| 77 }; | 78 }; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 // Now, re-serialize. | 160 // Now, re-serialize. |
| 160 ui::AXTreeUpdate out_update2; | 161 ui::AXTreeUpdate out_update2; |
| 161 ax_serializer.SerializeChanges(textfield_wrapper, &out_update2); | 162 ax_serializer.SerializeChanges(textfield_wrapper, &out_update2); |
| 162 | 163 |
| 163 size_t node_count = out_update2.nodes.size(); | 164 size_t node_count = out_update2.nodes.size(); |
| 164 | 165 |
| 165 // We should have far more updates this time around. | 166 // We should have far more updates this time around. |
| 166 ASSERT_GE(node_count, 10U); | 167 ASSERT_GE(node_count, 10U); |
| 167 | 168 |
| 168 ASSERT_EQ(textfield_wrapper->GetID(), out_update2.nodes[node_count - 1].id); | 169 int text_field_update_index = -1; |
| 169 ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, out_update2.nodes[node_count - 1].role); | 170 for (size_t i = 0; i < node_count; ++i) { |
| 171 if (textfield_wrapper->GetID() == out_update2.nodes[i].id) |
| 172 text_field_update_index = i; |
| 173 } |
| 174 |
| 175 ASSERT_NE(-1, text_field_update_index); |
| 176 ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, |
| 177 out_update2.nodes[text_field_update_index].role); |
| 170 } | 178 } |
| OLD | NEW |