| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "base/win/scoped_bstr.h" | 7 #include "base/win/scoped_bstr.h" |
| 8 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
| 9 #include "base/win/scoped_variant.h" | 9 #include "base/win/scoped_variant.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 // Delete the manager and test that all BrowserAccessibility instances are | 478 // Delete the manager and test that all BrowserAccessibility instances are |
| 479 // deleted. | 479 // deleted. |
| 480 manager.reset(); | 480 manager.reset(); |
| 481 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 481 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 482 } | 482 } |
| 483 | 483 |
| 484 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) { | 484 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) { |
| 485 const std::string text1_name = "One two three."; | 485 const std::string text1_name = "One two three."; |
| 486 const std::string text2_name = " Four five six."; | 486 const std::string text2_name = " Four five six."; |
| 487 const size_t text_name_len = text1_name.length() + text2_name.length(); | 487 const long text_name_len = text1_name.length() + text2_name.length(); |
| 488 | 488 |
| 489 ui::AXNodeData text1; | 489 ui::AXNodeData text1; |
| 490 text1.id = 11; | 490 text1.id = 11; |
| 491 text1.role = ui::AX_ROLE_STATIC_TEXT; | 491 text1.role = ui::AX_ROLE_STATIC_TEXT; |
| 492 text1.state = 1 << ui::AX_STATE_READ_ONLY; | 492 text1.state = 1 << ui::AX_STATE_READ_ONLY; |
| 493 text1.SetName(text1_name); | 493 text1.SetName(text1_name); |
| 494 | 494 |
| 495 ui::AXNodeData text2; | 495 ui::AXNodeData text2; |
| 496 text2.id = 12; | 496 text2.id = 12; |
| 497 text2.role = ui::AX_ROLE_STATIC_TEXT; | 497 text2.role = ui::AX_ROLE_STATIC_TEXT; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 const base::string16 text2_name = L" Four five six."; | 560 const base::string16 text2_name = L" Four five six."; |
| 561 const base::string16 check_box_name = L"I agree"; | 561 const base::string16 check_box_name = L"I agree"; |
| 562 const base::string16 check_box_value = L"Checked"; | 562 const base::string16 check_box_value = L"Checked"; |
| 563 const base::string16 button_text_name = L"Red"; | 563 const base::string16 button_text_name = L"Red"; |
| 564 const base::string16 link_text_name = L"Blue"; | 564 const base::string16 link_text_name = L"Blue"; |
| 565 // Each control (combo / check box, button and link) will be represented by an | 565 // Each control (combo / check box, button and link) will be represented by an |
| 566 // embedded object character. | 566 // embedded object character. |
| 567 const base::string16 embed(1, BrowserAccessibilityWin::kEmbeddedCharacter); | 567 const base::string16 embed(1, BrowserAccessibilityWin::kEmbeddedCharacter); |
| 568 const base::string16 root_hypertext = | 568 const base::string16 root_hypertext = |
| 569 text1_name + embed + text2_name + embed + embed + embed; | 569 text1_name + embed + text2_name + embed + embed + embed; |
| 570 const size_t root_hypertext_len = root_hypertext.length(); | 570 const long root_hypertext_len = root_hypertext.length(); |
| 571 | 571 |
| 572 ui::AXNodeData text1; | 572 ui::AXNodeData text1; |
| 573 text1.id = 11; | 573 text1.id = 11; |
| 574 text1.role = ui::AX_ROLE_STATIC_TEXT; | 574 text1.role = ui::AX_ROLE_STATIC_TEXT; |
| 575 text1.state = 1 << ui::AX_STATE_READ_ONLY; | 575 text1.state = 1 << ui::AX_STATE_READ_ONLY; |
| 576 text1.SetName(base::UTF16ToUTF8(text1_name)); | 576 text1.SetName(base::UTF16ToUTF8(text1_name)); |
| 577 | 577 |
| 578 ui::AXNodeData combo_box; | 578 ui::AXNodeData combo_box; |
| 579 combo_box.id = 12; | 579 combo_box.id = 12; |
| 580 combo_box.role = ui::AX_ROLE_COMBO_BOX; | 580 combo_box.role = ui::AX_ROLE_COMBO_BOX; |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 TEST_F(BrowserAccessibilityTest, TestSanitizeStringAttributeForIA2) { | 1477 TEST_F(BrowserAccessibilityTest, TestSanitizeStringAttributeForIA2) { |
| 1478 base::string16 input(L"\\:=,;"); | 1478 base::string16 input(L"\\:=,;"); |
| 1479 base::string16 output; | 1479 base::string16 output; |
| 1480 BrowserAccessibilityWin::SanitizeStringAttributeForIA2(input, &output); | 1480 BrowserAccessibilityWin::SanitizeStringAttributeForIA2(input, &output); |
| 1481 EXPECT_EQ(L"\\\\\\:\\=\\,\\;", output); | 1481 EXPECT_EQ(L"\\\\\\:\\=\\,\\;", output); |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 } // namespace content | 1484 } // namespace content |
| OLD | NEW |