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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_win_unittest.cc

Issue 135633002: Don't populate URL data in WebDropData when dragging files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Blink style enums Created 6 years, 11 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 | « ui/base/dragdrop/os_exchange_data_unittest.cc ('k') | no next file » | 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_handle.h" 6 #include "base/memory/scoped_handle.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/win/scoped_hglobal.h" 9 #include "base/win/scoped_hglobal.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 medium.hGlobal = glob; 58 medium.hGlobal = glob;
59 medium.pUnkForRelease = NULL; 59 medium.pUnkForRelease = NULL;
60 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE)); 60 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE));
61 61
62 // Construct a new object with the old object so that we can use our access 62 // Construct a new object with the old object so that we can use our access
63 // APIs. 63 // APIs.
64 OSExchangeData data2(data.provider().Clone()); 64 OSExchangeData data2(data.provider().Clone());
65 EXPECT_TRUE(data2.HasURL()); 65 EXPECT_TRUE(data2.HasURL());
66 GURL url_from_data; 66 GURL url_from_data;
67 std::wstring title; 67 std::wstring title;
68 EXPECT_TRUE(data2.GetURLAndTitle(&url_from_data, &title)); 68 EXPECT_TRUE(data2.GetURLAndTitle(
69 OSExchangeData::CONVERT_FILENAMES, &url_from_data, &title));
69 GURL reference_url(input); 70 GURL reference_url(input);
70 EXPECT_EQ(reference_url.spec(), url_from_data.spec()); 71 EXPECT_EQ(reference_url.spec(), url_from_data.spec());
71 } 72 }
72 73
73 // Verifies SetData invoked twice with the same data clobbers existing data. 74 // Verifies SetData invoked twice with the same data clobbers existing data.
74 TEST(OSExchangeDataWinTest, RemoveData) { 75 TEST(OSExchangeDataWinTest, RemoveData) {
75 OSExchangeData data; 76 OSExchangeData data;
76 std::wstring input = L"http://www.google.com/"; 77 std::wstring input = L"http://www.google.com/";
77 std::wstring input2 = L"http://www.google2.com/"; 78 std::wstring input2 = L"http://www.google2.com/";
78 79
(...skipping 30 matching lines...) Expand all
109 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE)); 110 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE));
110 } 111 }
111 EXPECT_EQ(1u, static_cast<DataObjectImpl*>(com_data.get())->size()); 112 EXPECT_EQ(1u, static_cast<DataObjectImpl*>(com_data.get())->size());
112 113
113 // Construct a new object with the old object so that we can use our access 114 // Construct a new object with the old object so that we can use our access
114 // APIs. 115 // APIs.
115 OSExchangeData data2(data.provider().Clone()); 116 OSExchangeData data2(data.provider().Clone());
116 EXPECT_TRUE(data2.HasURL()); 117 EXPECT_TRUE(data2.HasURL());
117 GURL url_from_data; 118 GURL url_from_data;
118 std::wstring title; 119 std::wstring title;
119 EXPECT_TRUE(data2.GetURLAndTitle(&url_from_data, &title)); 120 EXPECT_TRUE(data2.GetURLAndTitle(
121 OSExchangeData::CONVERT_FILENAMES, &url_from_data, &title));
120 EXPECT_EQ(GURL(input2).spec(), url_from_data.spec()); 122 EXPECT_EQ(GURL(input2).spec(), url_from_data.spec());
121 } 123 }
122 124
123 TEST(OSExchangeDataWinTest, URLDataAccessViaCOM) { 125 TEST(OSExchangeDataWinTest, URLDataAccessViaCOM) {
124 OSExchangeData data; 126 OSExchangeData data;
125 GURL url("http://www.google.com/"); 127 GURL url("http://www.google.com/");
126 data.SetURL(url, L""); 128 data.SetURL(url, L"");
127 base::win::ScopedComPtr<IDataObject> com_data( 129 base::win::ScopedComPtr<IDataObject> com_data(
128 OSExchangeDataProviderWin::GetIDataObject(data)); 130 OSExchangeDataProviderWin::GetIDataObject(data));
129 131
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 343 }
342 344
343 TEST(OSExchangeDataWinTest, ProvideURLForPlainTextURL) { 345 TEST(OSExchangeDataWinTest, ProvideURLForPlainTextURL) {
344 OSExchangeData data; 346 OSExchangeData data;
345 data.SetString(L"http://google.com"); 347 data.SetString(L"http://google.com");
346 348
347 OSExchangeData data2(data.provider().Clone()); 349 OSExchangeData data2(data.provider().Clone());
348 ASSERT_TRUE(data2.HasURL()); 350 ASSERT_TRUE(data2.HasURL());
349 GURL read_url; 351 GURL read_url;
350 std::wstring title; 352 std::wstring title;
351 EXPECT_TRUE(data2.GetURLAndTitle(&read_url, &title)); 353 EXPECT_TRUE(data2.GetURLAndTitle(
354 OSExchangeData::CONVERT_FILENAMES, &read_url, &title));
352 EXPECT_EQ(GURL("http://google.com"), read_url); 355 EXPECT_EQ(GURL("http://google.com"), read_url);
353 } 356 }
354 357
355 } // namespace ui 358 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698