OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/clipboard/clipboard_util_win.h" | 5 #include "app/clipboard/clipboard_util_win.h" |
6 #include "app/os_exchange_data.h" | 6 #include "app/os_exchange_data.h" |
7 #include "app/os_exchange_data_provider_win.h" | 7 #include "app/os_exchange_data_provider_win.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/scoped_handle.h" | 10 #include "base/scoped_handle.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 EXPECT_TRUE(data2.GetString(&output_string)); | 263 EXPECT_TRUE(data2.GetString(&output_string)); |
264 EXPECT_EQ(url_spec, WideToUTF8(output_string)); | 264 EXPECT_EQ(url_spec, WideToUTF8(output_string)); |
265 | 265 |
266 // File contents access via COM | 266 // File contents access via COM |
267 ScopedComPtr<IDataObject> com_data( | 267 ScopedComPtr<IDataObject> com_data( |
268 OSExchangeDataProviderWin::GetIDataObject(data)); | 268 OSExchangeDataProviderWin::GetIDataObject(data)); |
269 { | 269 { |
270 CLIPFORMAT cfstr_file_contents = | 270 CLIPFORMAT cfstr_file_contents = |
271 RegisterClipboardFormat(CFSTR_FILECONTENTS); | 271 RegisterClipboardFormat(CFSTR_FILECONTENTS); |
272 FORMATETC format_etc = | 272 FORMATETC format_etc = |
273 { cfstr_file_contents, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; | 273 { cfstr_file_contents, NULL, DVASPECT_CONTENT, 0, TYMED_HGLOBAL }; |
274 EXPECT_EQ(S_OK, com_data->QueryGetData(&format_etc)); | 274 EXPECT_EQ(S_OK, com_data->QueryGetData(&format_etc)); |
275 | 275 |
276 STGMEDIUM medium; | 276 STGMEDIUM medium; |
277 EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium)); | 277 EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium)); |
278 ScopedHGlobal<char> glob(medium.hGlobal); | 278 ScopedHGlobal<char> glob(medium.hGlobal); |
279 std::string output(glob.get(), glob.Size()); | 279 std::string output(glob.get(), glob.Size()); |
280 std::string file_contents = "[InternetShortcut]\r\nURL="; | 280 std::string file_contents = "[InternetShortcut]\r\nURL="; |
281 file_contents += url_spec; | 281 file_contents += url_spec; |
282 file_contents += "\r\n"; | 282 file_contents += "\r\n"; |
283 EXPECT_EQ(file_contents, output); | 283 EXPECT_EQ(file_contents, output); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 OSExchangeData data; | 363 OSExchangeData data; |
364 data.SetString(L"http://google.com"); | 364 data.SetString(L"http://google.com"); |
365 | 365 |
366 OSExchangeData data2(CloneProvider(data)); | 366 OSExchangeData data2(CloneProvider(data)); |
367 ASSERT_TRUE(data2.HasURL()); | 367 ASSERT_TRUE(data2.HasURL()); |
368 GURL read_url; | 368 GURL read_url; |
369 std::wstring title; | 369 std::wstring title; |
370 EXPECT_TRUE(data2.GetURLAndTitle(&read_url, &title)); | 370 EXPECT_TRUE(data2.GetURLAndTitle(&read_url, &title)); |
371 EXPECT_EQ(GURL("http://google.com"), read_url); | 371 EXPECT_EQ(GURL("http://google.com"), read_url); |
372 } | 372 } |
OLD | NEW |