OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
6 #include "chrome/browser/browser_accessibility_manager.h" | 6 #include "chrome/browser/browser_accessibility_manager_win.h" |
7 #include "chrome/browser/browser_accessibility.h" | 7 #include "chrome/browser/browser_accessibility_win.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using webkit_glue::WebAccessibility; | 10 using webkit_glue::WebAccessibility; |
11 | 11 |
12 // Subclass of BrowserAccessibility that counts the number of instances. | 12 // Subclass of BrowserAccessibility that counts the number of instances. |
13 class CountedBrowserAccessibility : public BrowserAccessibility { | 13 class CountedBrowserAccessibility : public BrowserAccessibility { |
14 public: | 14 public: |
15 CountedBrowserAccessibility() { global_obj_count_++; } | 15 CountedBrowserAccessibility() { global_obj_count_++; } |
16 virtual ~CountedBrowserAccessibility() { global_obj_count_--; } | 16 virtual ~CountedBrowserAccessibility() { global_obj_count_--; } |
17 static int global_obj_count_; | 17 static int global_obj_count_; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 delete manager; | 102 delete manager; |
103 ASSERT_EQ(2, CountedBrowserAccessibility::global_obj_count_); | 103 ASSERT_EQ(2, CountedBrowserAccessibility::global_obj_count_); |
104 | 104 |
105 // Release each of our references and make sure that each one results in | 105 // Release each of our references and make sure that each one results in |
106 // the instance being deleted as its reference count hits zero. | 106 // the instance being deleted as its reference count hits zero. |
107 root_iaccessible->Release(); | 107 root_iaccessible->Release(); |
108 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); | 108 ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); |
109 child1_iaccessible->Release(); | 109 child1_iaccessible->Release(); |
110 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); | 110 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); |
111 } | 111 } |
OLD | NEW |