| 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 "content/browser/accessibility/dump_accessibility_tree_helper.h" | 5 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
| 6 | 6 |
| 7 #include <oleacc.h> | 7 #include <oleacc.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 14 #include "content/browser/accessibility/browser_accessibility_win.h" | 15 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 15 #include "content/common/accessibility_node_data.h" | 16 #include "content/common/accessibility_node_data.h" |
| 16 #include "content/public/test/accessibility_test_utils_win.h" | 17 #include "content/public/test/accessibility_test_utils_win.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "third_party/iaccessible2/ia2_api_all.h" | 19 #include "third_party/iaccessible2/ia2_api_all.h" |
| 19 #include "ui/base/win/atl_module.h" | 20 #include "ui/base/win/atl_module.h" |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 it != state_strings.end(); | 60 it != state_strings.end(); |
| 60 ++it) { | 61 ++it) { |
| 61 Add(false, *it); | 62 Add(false, *it); |
| 62 } | 63 } |
| 63 for (std::vector<string16>::const_iterator it = ia2_attributes.begin(); | 64 for (std::vector<string16>::const_iterator it = ia2_attributes.begin(); |
| 64 it != ia2_attributes.end(); | 65 it != ia2_attributes.end(); |
| 65 ++it) { | 66 ++it) { |
| 66 Add(false, *it); | 67 Add(false, *it); |
| 67 } | 68 } |
| 68 Add(false, L"role_name='" + acc_obj->role_name() + L"'"); | 69 Add(false, L"role_name='" + acc_obj->role_name() + L"'"); |
| 69 Add(false, L"value='" + acc_obj->value() + L"'"); | 70 VARIANT currentValue; |
| 71 if (acc_obj->get_currentValue(¤tValue) != S_FALSE) |
| 72 Add(false, StringPrintf(L"currentValue=%.2f", V_R8(¤tValue))); |
| 73 VARIANT minimumValue; |
| 74 if (acc_obj->get_minimumValue(&minimumValue) != S_FALSE) |
| 75 Add(false, StringPrintf(L"minimumValue=%.2f", V_R8(&minimumValue))); |
| 76 VARIANT maximumValue; |
| 77 if (acc_obj->get_maximumValue(&maximumValue) != S_FALSE) |
| 78 Add(false, StringPrintf(L"maximumValue=%.2f", V_R8(&maximumValue))); |
| 70 Add(false, L"description='" + description + L"'"); | 79 Add(false, L"description='" + description + L"'"); |
| 71 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 80 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); |
| 72 } | 81 } |
| 73 | 82 |
| 74 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() | 83 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() |
| 75 const { | 84 const { |
| 76 return FILE_PATH_LITERAL("-actual-win.txt"); | 85 return FILE_PATH_LITERAL("-actual-win.txt"); |
| 77 } | 86 } |
| 78 | 87 |
| 79 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() | 88 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() |
| 80 const { | 89 const { |
| 81 return FILE_PATH_LITERAL("-expected-win.txt"); | 90 return FILE_PATH_LITERAL("-expected-win.txt"); |
| 82 } | 91 } |
| 83 | 92 |
| 84 | 93 |
| 85 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { | 94 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { |
| 86 return "@WIN-ALLOW:"; | 95 return "@WIN-ALLOW:"; |
| 87 } | 96 } |
| 88 | 97 |
| 89 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { | 98 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { |
| 90 return "@WIN-DENY:"; | 99 return "@WIN-DENY:"; |
| 91 } | 100 } |
| 92 | 101 |
| 93 } // namespace content | 102 } // namespace content |
| OLD | NEW |