OLD | NEW |
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_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/win/scoped_hglobal.h" | 8 #include "base/win/scoped_hglobal.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/clipboard/clipboard.h" | 10 #include "ui/base/clipboard/clipboard.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE)); | 59 EXPECT_EQ(S_OK, com_data->SetData(&format_etc, &medium, TRUE)); |
60 | 60 |
61 // Construct a new object with the old object so that we can use our access | 61 // Construct a new object with the old object so that we can use our access |
62 // APIs. | 62 // APIs. |
63 OSExchangeData data2(data.provider().Clone()); | 63 OSExchangeData data2(data.provider().Clone()); |
64 EXPECT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES)); | 64 EXPECT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES)); |
65 GURL url_from_data; | 65 GURL url_from_data; |
66 std::wstring title; | 66 std::wstring title; |
67 EXPECT_TRUE(data2.GetURLAndTitle( | 67 EXPECT_TRUE(data2.GetURLAndTitle( |
68 OSExchangeData::CONVERT_FILENAMES, &url_from_data, &title)); | 68 OSExchangeData::CONVERT_FILENAMES, &url_from_data, &title)); |
69 GURL reference_url(in put); | 69 GURL reference_url(input); |
70 EXPECT_EQ(reference_url.spec(), url_from_data.spec()); | 70 EXPECT_EQ(reference_url.spec(), url_from_data.spec()); |
71 } | 71 } |
72 | 72 |
73 // Verifies SetData invoked twice with the same data clobbers existing data. | 73 // Verifies SetData invoked twice with the same data clobbers existing data. |
74 TEST(OSExchangeDataWinTest, RemoveData) { | 74 TEST(OSExchangeDataWinTest, RemoveData) { |
75 OSExchangeData data; | 75 OSExchangeData data; |
76 std::wstring input = L"http://www.google.com/"; | 76 std::wstring input = L"http://www.google.com/"; |
77 std::wstring input2 = L"http://www.google2.com/"; | 77 std::wstring input2 = L"http://www.google2.com/"; |
78 | 78 |
79 base::win::ScopedComPtr<IDataObject> com_data( | 79 base::win::ScopedComPtr<IDataObject> com_data( |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 OSExchangeData data2(data.provider().Clone()); | 348 OSExchangeData data2(data.provider().Clone()); |
349 ASSERT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES)); | 349 ASSERT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES)); |
350 GURL read_url; | 350 GURL read_url; |
351 std::wstring title; | 351 std::wstring title; |
352 EXPECT_TRUE(data2.GetURLAndTitle( | 352 EXPECT_TRUE(data2.GetURLAndTitle( |
353 OSExchangeData::CONVERT_FILENAMES, &read_url, &title)); | 353 OSExchangeData::CONVERT_FILENAMES, &read_url, &title)); |
354 EXPECT_EQ(GURL("http://google.com"), read_url); | 354 EXPECT_EQ(GURL("http://google.com"), read_url); |
355 } | 355 } |
356 | 356 |
357 } // namespace ui | 357 } // namespace ui |
OLD | NEW |