Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/accessibility/browser_accessibility_win_unittest.cc

Issue 8467002: Fix double-initialization of CComModule. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/win/atl_module.h"
6 #include "base/win/scoped_comptr.h" 7 #include "base/win/scoped_comptr.h"
7 #include "content/browser/accessibility/browser_accessibility_manager.h" 8 #include "content/browser/accessibility/browser_accessibility_manager.h"
8 #include "content/browser/accessibility/browser_accessibility_win.h" 9 #include "content/browser/accessibility/browser_accessibility_win.h"
9 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 using webkit_glue::WebAccessibility; 13 using webkit_glue::WebAccessibility;
13 14
14 namespace { 15 namespace {
15 16
(...skipping 29 matching lines...) Expand all
45 46
46 V_VT(&variant) = VT_I4; 47 V_VT(&variant) = VT_I4;
47 V_I4(&variant) = value; 48 V_I4(&variant) = value;
48 49
49 return variant; 50 return variant;
50 } 51 }
51 52
52 class BrowserAccessibilityTest : public testing::Test { 53 class BrowserAccessibilityTest : public testing::Test {
53 protected: 54 protected:
54 virtual void SetUp() { 55 virtual void SetUp() {
55 // ATL needs a pointer to a COM module. 56 base::win::CreateATLModuleIfNeeded();
56 static CComModule module;
57 _pAtlModule = &module;
58
59 // Make sure COM is initialized for this thread; it's safe to call twice.
60 ::CoInitialize(NULL); 57 ::CoInitialize(NULL);
61 } 58 }
62 59
63 virtual void TearDown() { 60 virtual void TearDown() {
64 ::CoUninitialize(); 61 ::CoUninitialize();
65 } 62 }
66 }; 63 };
67 64
68 // Test that BrowserAccessibilityManager correctly releases the tree of 65 // Test that BrowserAccessibilityManager correctly releases the tree of
69 // BrowserAccessibility instances upon delete. 66 // BrowserAccessibility instances upon delete.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 358
362 ASSERT_EQ(S_OK, text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, &text)); 359 ASSERT_EQ(S_OK, text1_obj->get_text(0, IA2_TEXT_OFFSET_LENGTH, &text));
363 ASSERT_EQ(text, string16(L"One two three.\nFour five six.")); 360 ASSERT_EQ(text, string16(L"One two three.\nFour five six."));
364 SysFreeString(text); 361 SysFreeString(text);
365 362
366 // Delete the manager and test that all BrowserAccessibility instances are 363 // Delete the manager and test that all BrowserAccessibility instances are
367 // deleted. 364 // deleted.
368 delete manager; 365 delete manager;
369 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); 366 ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_);
370 } 367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698