| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_provider_aurax11.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
| 6 | 6 |
| 7 // Clean up X11 header polution | 7 // Clean up X11 header polution |
| 8 #undef None | 8 #undef None |
| 9 #undef Bool | 9 #undef Bool |
| 10 | 10 |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 const char kGoogleTitle[] = "Google"; | 17 const char kGoogleTitle[] = "Google"; |
| 18 const char kGoogleURL[] = "http://www.google.com/"; | 18 const char kGoogleURL[] = "http://www.google.com/"; |
| 19 | 19 |
| 20 TEST(OSExchangeDataProviderAuraX11Test, MozillaURL) { | 20 TEST(OSExchangeDataProviderAuraX11Test, MozillaURL) { |
| 21 base::MessageLoopForUI message_loop; | 21 base::MessageLoopForUI message_loop; |
| 22 ui::OSExchangeDataProviderAuraX11 provider; | 22 ui::OSExchangeDataProviderAuraX11 provider; |
| 23 | 23 |
| 24 // Check that we can get titled entries. | 24 // Check that we can get titled entries. |
| 25 provider.SetURL(GURL(kGoogleURL), ASCIIToUTF16(kGoogleTitle)); | 25 provider.SetURL(GURL(kGoogleURL), ASCIIToUTF16(kGoogleTitle)); |
| 26 { | 26 { |
| 27 GURL out_gurl; | 27 GURL out_gurl; |
| 28 base::string16 out_str; | 28 base::string16 out_str; |
| 29 EXPECT_TRUE(provider.GetURLAndTitle(&out_gurl, &out_str)); | 29 EXPECT_TRUE(provider.GetURLAndTitle( |
| 30 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &out_gurl, &out_str)); |
| 30 EXPECT_EQ(ASCIIToUTF16(kGoogleTitle), out_str); | 31 EXPECT_EQ(ASCIIToUTF16(kGoogleTitle), out_str); |
| 31 EXPECT_EQ(kGoogleURL, out_gurl.spec()); | 32 EXPECT_EQ(kGoogleURL, out_gurl.spec()); |
| 32 } | 33 } |
| 33 | 34 |
| 34 // Check that we can get non-titled entries. | 35 // Check that we can get non-titled entries. |
| 35 provider.SetURL(GURL(kGoogleURL), string16()); | 36 provider.SetURL(GURL(kGoogleURL), string16()); |
| 36 { | 37 { |
| 37 GURL out_gurl; | 38 GURL out_gurl; |
| 38 base::string16 out_str; | 39 base::string16 out_str; |
| 39 EXPECT_TRUE(provider.GetURLAndTitle(&out_gurl, &out_str)); | 40 EXPECT_TRUE(provider.GetURLAndTitle( |
| 41 OSExchangeData::DO_NOT_CONVERT_FILENAMES, &out_gurl, &out_str)); |
| 40 EXPECT_EQ(string16(), out_str); | 42 EXPECT_EQ(string16(), out_str); |
| 41 EXPECT_EQ(kGoogleURL, out_gurl.spec()); | 43 EXPECT_EQ(kGoogleURL, out_gurl.spec()); |
| 42 } | 44 } |
| 43 } | 45 } |
| OLD | NEW |