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

Side by Side Diff: chrome/common/os_exchange_data_unittest.cc

Issue 40226: Fix files with lines > 80 cols. Part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/notification_service_unittest.cc ('k') | chrome/common/pref_service.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <shlobj.h> 6 #include <shlobj.h>
7 7
8 #include "base/clipboard_util.h" 8 #include "base/clipboard_util.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 EXPECT_EQ(url_title, output_title); 252 EXPECT_EQ(url_title, output_title);
253 std::wstring output_string; 253 std::wstring output_string;
254 254
255 // URL should be the raw text response 255 // URL should be the raw text response
256 EXPECT_TRUE(data2->GetString(&output_string)); 256 EXPECT_TRUE(data2->GetString(&output_string));
257 EXPECT_EQ(url_spec, WideToUTF8(output_string)); 257 EXPECT_EQ(url_spec, WideToUTF8(output_string));
258 258
259 // File contents access via COM 259 // File contents access via COM
260 CComPtr<IDataObject> com_data(data); 260 CComPtr<IDataObject> com_data(data);
261 { 261 {
262 CLIPFORMAT cfstr_file_contents = RegisterClipboardFormat(CFSTR_FILECONTENTS) ; 262 CLIPFORMAT cfstr_file_contents =
263 RegisterClipboardFormat(CFSTR_FILECONTENTS);
263 FORMATETC format_etc = 264 FORMATETC format_etc =
264 { cfstr_file_contents, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; 265 { cfstr_file_contents, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
265 EXPECT_EQ(S_OK, com_data->QueryGetData(&format_etc)); 266 EXPECT_EQ(S_OK, com_data->QueryGetData(&format_etc));
266 267
267 STGMEDIUM medium; 268 STGMEDIUM medium;
268 EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium)); 269 EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
269 ScopedHGlobal<char> glob(medium.hGlobal); 270 ScopedHGlobal<char> glob(medium.hGlobal);
270 std::string output(glob.get(), glob.Size()); 271 std::string output(glob.get(), glob.Size());
271 std::string file_contents = "[InternetShortcut]\r\nURL=" + url_spec + "\r\n" ; 272 std::string file_contents = "[InternetShortcut]\r\nURL=";
273 file_contents += url_spec;
274 file_contents += "\r\n";
272 EXPECT_EQ(file_contents, output); 275 EXPECT_EQ(file_contents, output);
273 ReleaseStgMedium(&medium); 276 ReleaseStgMedium(&medium);
274 } 277 }
275 278
276 // Need to manually free data2 since we never stuff it into a COMPtr. 279 // Need to manually free data2 since we never stuff it into a COMPtr.
277 delete data2; 280 delete data2;
278 } 281 }
279 282
280 TEST(OSExchangeDataTest, TestPickledData) { 283 TEST(OSExchangeDataTest, TestPickledData) {
281 CLIPFORMAT test_cf = RegisterClipboardFormat(L"chrome/test"); 284 CLIPFORMAT test_cf = RegisterClipboardFormat(L"chrome/test");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 data->SetString(L"http://google.com"); 357 data->SetString(L"http://google.com");
355 358
356 scoped_ptr<OSExchangeData> data2(new OSExchangeData(data.get())); 359 scoped_ptr<OSExchangeData> data2(new OSExchangeData(data.get()));
357 ASSERT_TRUE(data2->HasURL()); 360 ASSERT_TRUE(data2->HasURL());
358 GURL read_url; 361 GURL read_url;
359 std::wstring title; 362 std::wstring title;
360 EXPECT_TRUE(data2->GetURLAndTitle(&read_url, &title)); 363 EXPECT_TRUE(data2->GetURLAndTitle(&read_url, &title));
361 EXPECT_EQ(GURL("http://google.com"), read_url); 364 EXPECT_EQ(GURL("http://google.com"), read_url);
362 } 365 }
363 366
OLDNEW
« no previous file with comments | « chrome/common/notification_service_unittest.cc ('k') | chrome/common/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698