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

Unified Diff: base/win/iunknown_impl_unittest.cc

Issue 8588036: Improve support for multiselect list box accessibility on Windows. (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 side-by-side diff with in-line comments
Download patch
Index: base/win/iunknown_impl_unittest.cc
===================================================================
--- base/win/iunknown_impl_unittest.cc (revision 0)
+++ base/win/iunknown_impl_unittest.cc (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/win/iunknown_impl.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
+namespace win {
+
+class TestIUnknownImplSubclass : public IUnknownImpl {
+ public:
+ TestIUnknownImplSubclass() {
+ ++instance_count;
+ }
+ virtual ~TestIUnknownImplSubclass() {
+ --instance_count;
+ }
+ static int instance_count;
+};
+
+// static
+int TestIUnknownImplSubclass::instance_count = 0;
+
+TEST(IUnknownImplTest, IUnknownImpl) {
+ EXPECT_TRUE(SUCCEEDED(::CoInitialize(NULL)));
+
+ {
+ EXPECT_EQ(0, TestIUnknownImplSubclass::instance_count);
+ IUnknown* u = new TestIUnknownImplSubclass();
+
+ EXPECT_EQ(1, TestIUnknownImplSubclass::instance_count);
+
+ EXPECT_EQ(1, u->AddRef());
+ EXPECT_EQ(2, u->AddRef());
+
+ IUnknown* other = NULL;
+ EXPECT_EQ(E_NOINTERFACE, u->QueryInterface(
+ IID_IDispatch, reinterpret_cast<void**>(&other)));
+ EXPECT_EQ(S_OK, u->QueryInterface(
+ IID_IUnknown, reinterpret_cast<void**>(&other)));
+ other->Release();
+
+ EXPECT_EQ(1, u->Release());
+ EXPECT_EQ(0, u->Release());
+ EXPECT_EQ(0, TestIUnknownImplSubclass::instance_count);
+ }
+
+ ::CoUninitialize();
+}
+
+} // namespace win
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698