| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/pickle.h" | 6 #include "base/pickle.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
| 10 #include "ui/base/dragdrop/os_exchange_data.h" | 10 #include "ui/base/dragdrop/os_exchange_data.h" |
| 11 #include "ui/events/platform/platform_event_source.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 class OSExchangeDataTest : public PlatformTest { | 16 class OSExchangeDataTest : public PlatformTest { |
| 17 public: |
| 18 OSExchangeDataTest() |
| 19 : event_source_(ui::PlatformEventSource::CreateDefault()) {} |
| 20 |
| 16 private: | 21 private: |
| 17 base::MessageLoopForUI message_loop_; | 22 base::MessageLoopForUI message_loop_; |
| 23 scoped_ptr<PlatformEventSource> event_source_; |
| 18 }; | 24 }; |
| 19 | 25 |
| 20 TEST_F(OSExchangeDataTest, StringDataGetAndSet) { | 26 TEST_F(OSExchangeDataTest, StringDataGetAndSet) { |
| 21 OSExchangeData data; | 27 OSExchangeData data; |
| 22 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?"); | 28 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?"); |
| 23 data.SetString(input); | 29 data.SetString(input); |
| 24 | 30 |
| 25 OSExchangeData data2(data.provider().Clone()); | 31 OSExchangeData data2(data.provider().Clone()); |
| 26 base::string16 output; | 32 base::string16 output; |
| 27 EXPECT_TRUE(data2.GetString(&output)); | 33 EXPECT_TRUE(data2.GetString(&output)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 "</BODY>\n</HTML>"); | 97 "</BODY>\n</HTML>"); |
| 92 data.SetHtml(html, url); | 98 data.SetHtml(html, url); |
| 93 | 99 |
| 94 OSExchangeData copy(data.provider().Clone()); | 100 OSExchangeData copy(data.provider().Clone()); |
| 95 base::string16 read_html; | 101 base::string16 read_html; |
| 96 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); | 102 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); |
| 97 EXPECT_EQ(html, read_html); | 103 EXPECT_EQ(html, read_html); |
| 98 } | 104 } |
| 99 | 105 |
| 100 } // namespace ui | 106 } // namespace ui |
| OLD | NEW |