Chromium Code Reviews| 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 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "content/browser/accessibility/browser_accessibility_cocoa.h" | 11 #include "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 12 #include "content/browser/accessibility/browser_accessibility_mac.h" | 12 #include "content/browser/accessibility/browser_accessibility_mac.h" |
| 13 | 13 |
| 14 void DumpAccessibilityTreeHelper::Initialize() {} | 14 void DumpAccessibilityTreeHelper::Initialize() {} |
| 15 | 15 |
| 16 string16 DumpAccessibilityTreeHelper::ToString(BrowserAccessibility* node) { | 16 string16 DumpAccessibilityTreeHelper::ToString(BrowserAccessibility* node, |
| 17 char* prefix) { | |
| 17 BrowserAccessibilityCocoa* cocoa_node = node->toBrowserAccessibilityCocoa(); | 18 BrowserAccessibilityCocoa* cocoa_node = node->toBrowserAccessibilityCocoa(); |
| 18 NSString* dump = [NSString stringWithFormat:@"%@|%@|%@|%@", | 19 NSString* dump = |
| 19 [cocoa_node role], | 20 [NSString stringWithFormat:@"%s%@ subrole=%@ title='%@' value='%@'\n", |
|
David Tseng
2012/03/06 23:49:05
Could you also include "role=", and perhaps we sho
dmazzoni
2012/03/08 07:10:37
Are you okay to try it without role? I tried addin
| |
| 20 [cocoa_node subrole], | 21 prefix, |
| 21 [cocoa_node title], | 22 [cocoa_node role], |
| 22 [cocoa_node value]]; | 23 [cocoa_node subrole], |
| 24 [cocoa_node title], | |
| 25 [cocoa_node value]]; | |
| 23 std::string tempVal = [dump cStringUsingEncoding:NSUTF8StringEncoding]; | 26 std::string tempVal = [dump cStringUsingEncoding:NSUTF8StringEncoding]; |
| 24 | 27 |
| 25 return UTF8ToUTF16(tempVal); | 28 return UTF8ToUTF16(tempVal); |
| 26 } | 29 } |
| 27 | 30 |
| 28 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() | 31 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() |
| 29 const { | 32 const { |
| 30 return FILE_PATH_LITERAL("-actual-mac.txt"); | 33 return FILE_PATH_LITERAL("-actual-mac.txt"); |
| 31 } | 34 } |
| 32 | 35 |
| 33 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() | 36 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() |
| 34 const { | 37 const { |
| 35 return FILE_PATH_LITERAL("-expected-mac.txt"); | 38 return FILE_PATH_LITERAL("-expected-mac.txt"); |
| 36 } | 39 } |
| 37 | |
| 38 const string16 DumpAccessibilityTreeHelper::GetLineEnding() const { | |
| 39 return UTF8ToUTF16("\n"); | |
| 40 } | |
| OLD | NEW |