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

Side by Side Diff: base/win/scoped_comptr_unittest.cc

Issue 2870263002: Rename ScopedComPtr::Receive to ScopedComPtr::GetAddressOf (Closed)
Patch Set: Rebase to 2a6f440 Created 3 years, 7 months 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
« no previous file with comments | « base/win/scoped_comptr.h ('k') | chrome/browser/google/google_update_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/win/scoped_comptr.h" 5 #include "base/win/scoped_comptr.h"
6 6
7 #include <objbase.h> 7 #include <objbase.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 28 matching lines...) Expand all
39 EXPECT_TRUE(com_initializer.succeeded()); 39 EXPECT_TRUE(com_initializer.succeeded());
40 40
41 ScopedComPtr<IUnknown> unk; 41 ScopedComPtr<IUnknown> unk;
42 EXPECT_TRUE(SUCCEEDED(unk.CreateInstance(CLSID_ShellLink))); 42 EXPECT_TRUE(SUCCEEDED(unk.CreateInstance(CLSID_ShellLink)));
43 ScopedComPtr<IUnknown> unk2; 43 ScopedComPtr<IUnknown> unk2;
44 unk2.Attach(unk.Detach()); 44 unk2.Attach(unk.Detach());
45 EXPECT_TRUE(unk.Get() == NULL); 45 EXPECT_TRUE(unk.Get() == NULL);
46 EXPECT_TRUE(unk2.Get() != NULL); 46 EXPECT_TRUE(unk2.Get() != NULL);
47 47
48 ScopedComPtr<IMalloc> mem_alloc; 48 ScopedComPtr<IMalloc> mem_alloc;
49 EXPECT_TRUE(SUCCEEDED(CoGetMalloc(1, mem_alloc.Receive()))); 49 EXPECT_TRUE(SUCCEEDED(CoGetMalloc(1, mem_alloc.GetAddressOf())));
50 50
51 ScopedComPtr<IUnknown> qi_test; 51 ScopedComPtr<IUnknown> qi_test;
52 EXPECT_HRESULT_SUCCEEDED(mem_alloc.CopyTo(IID_PPV_ARGS(&qi_test))); 52 EXPECT_HRESULT_SUCCEEDED(mem_alloc.CopyTo(IID_PPV_ARGS(&qi_test)));
53 EXPECT_TRUE(qi_test.Get() != NULL); 53 EXPECT_TRUE(qi_test.Get() != NULL);
54 } 54 }
55 55
56 TEST(ScopedComPtrTest, ScopedComPtrVector) { 56 TEST(ScopedComPtrTest, ScopedComPtrVector) {
57 // Verify we don't get error C2558. 57 // Verify we don't get error C2558.
58 typedef ScopedComPtr<Dummy, &dummy_iid> Ptr; 58 typedef ScopedComPtr<Dummy, &dummy_iid> Ptr;
59 std::vector<Ptr> bleh; 59 std::vector<Ptr> bleh;
(...skipping 18 matching lines...) Expand all
78 bleh.pop_back(); 78 bleh.pop_back();
79 EXPECT_EQ(p->adds, 4); 79 EXPECT_EQ(p->adds, 4);
80 EXPECT_EQ(p->releases, 2); 80 EXPECT_EQ(p->releases, 2);
81 } 81 }
82 EXPECT_EQ(p->adds, 4); 82 EXPECT_EQ(p->adds, 4);
83 EXPECT_EQ(p->releases, 4); 83 EXPECT_EQ(p->releases, 4);
84 } 84 }
85 85
86 } // namespace win 86 } // namespace win
87 } // namespace base 87 } // namespace base
OLDNEW
« no previous file with comments | « base/win/scoped_comptr.h ('k') | chrome/browser/google/google_update_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698