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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_win_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 | « ui/accessibility/platform/ax_platform_node_win_unittest.cc ('k') | ui/base/win/shell.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) 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 "ui/base/dragdrop/os_exchange_data.h" 5 #include "ui/base/dragdrop/os_exchange_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 data.SetString(L"O hai googlz."); 178 data.SetString(L"O hai googlz.");
179 179
180 CLIPFORMAT cfstr_file_group_descriptor = 180 CLIPFORMAT cfstr_file_group_descriptor =
181 RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR); 181 RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR);
182 CLIPFORMAT text_x_moz_url = RegisterClipboardFormat(L"text/x-moz-url"); 182 CLIPFORMAT text_x_moz_url = RegisterClipboardFormat(L"text/x-moz-url");
183 183
184 base::win::ScopedComPtr<IDataObject> com_data( 184 base::win::ScopedComPtr<IDataObject> com_data(
185 OSExchangeDataProviderWin::GetIDataObject(data)); 185 OSExchangeDataProviderWin::GetIDataObject(data));
186 base::win::ScopedComPtr<IEnumFORMATETC> enumerator; 186 base::win::ScopedComPtr<IEnumFORMATETC> enumerator;
187 EXPECT_EQ(S_OK, com_data.Get()->EnumFormatEtc(DATADIR_GET, 187 EXPECT_EQ(S_OK, com_data.Get()->EnumFormatEtc(DATADIR_GET,
188 enumerator.Receive())); 188 enumerator.GetAddressOf()));
189 189
190 // Test that we can get one item. 190 // Test that we can get one item.
191 { 191 {
192 // Explictly don't reset the first time, to verify the creation state is 192 // Explictly don't reset the first time, to verify the creation state is
193 // OK. 193 // OK.
194 ULONG retrieved = 0; 194 ULONG retrieved = 0;
195 FORMATETC elements_array[1]; 195 FORMATETC elements_array[1];
196 EXPECT_EQ(S_OK, enumerator->Next(1, 196 EXPECT_EQ(S_OK, enumerator->Next(1,
197 reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); 197 reinterpret_cast<FORMATETC*>(&elements_array), &retrieved));
198 EXPECT_EQ(1u, retrieved); 198 EXPECT_EQ(1u, retrieved);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_EQ(1u, retrieved); 231 EXPECT_EQ(1u, retrieved);
232 EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat); 232 EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat);
233 } 233 }
234 234
235 // Test that we can skip the first item, and create a clone that matches in 235 // Test that we can skip the first item, and create a clone that matches in
236 // this state, and modify the original without affecting the clone. 236 // this state, and modify the original without affecting the clone.
237 { 237 {
238 EXPECT_EQ(S_OK, enumerator->Reset()); 238 EXPECT_EQ(S_OK, enumerator->Reset());
239 EXPECT_EQ(S_OK, enumerator->Skip(1)); 239 EXPECT_EQ(S_OK, enumerator->Skip(1));
240 base::win::ScopedComPtr<IEnumFORMATETC> cloned_enumerator; 240 base::win::ScopedComPtr<IEnumFORMATETC> cloned_enumerator;
241 EXPECT_EQ(S_OK, enumerator.Get()->Clone(cloned_enumerator.Receive())); 241 EXPECT_EQ(S_OK, enumerator.Get()->Clone(cloned_enumerator.GetAddressOf()));
242 EXPECT_EQ(S_OK, enumerator.Get()->Reset()); 242 EXPECT_EQ(S_OK, enumerator.Get()->Reset());
243 243
244 { 244 {
245 ULONG retrieved = 0; 245 ULONG retrieved = 0;
246 FORMATETC elements_array[1]; 246 FORMATETC elements_array[1];
247 EXPECT_EQ(S_OK, cloned_enumerator->Next(1, 247 EXPECT_EQ(S_OK, cloned_enumerator->Next(1,
248 reinterpret_cast<FORMATETC*>(&elements_array), &retrieved)); 248 reinterpret_cast<FORMATETC*>(&elements_array), &retrieved));
249 EXPECT_EQ(1u, retrieved); 249 EXPECT_EQ(1u, retrieved);
250 EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat); 250 EXPECT_EQ(cfstr_file_group_descriptor, elements_array[0].cfFormat);
251 } 251 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 OSExchangeData data2(data.provider().Clone()); 344 OSExchangeData data2(data.provider().Clone());
345 ASSERT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES)); 345 ASSERT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES));
346 GURL read_url; 346 GURL read_url;
347 std::wstring title; 347 std::wstring title;
348 EXPECT_TRUE(data2.GetURLAndTitle( 348 EXPECT_TRUE(data2.GetURLAndTitle(
349 OSExchangeData::CONVERT_FILENAMES, &read_url, &title)); 349 OSExchangeData::CONVERT_FILENAMES, &read_url, &title));
350 EXPECT_EQ(GURL("http://google.com"), read_url); 350 EXPECT_EQ(GURL("http://google.com"), read_url);
351 } 351 }
352 352
353 } // namespace ui 353 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_win_unittest.cc ('k') | ui/base/win/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698