| 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "net/base/filename_util.h" | 10 #include "net/base/filename_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 13 #include "ui/base/dragdrop/os_exchange_data.h" | 13 #include "ui/base/dragdrop/os_exchange_data.h" |
| 14 #include "ui/events/platform/platform_event_source.h" | 14 #include "ui/events/platform/platform_event_source.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class OSExchangeDataTest : public PlatformTest { | 19 class OSExchangeDataTest : public PlatformTest { |
| 20 public: | 20 public: |
| 21 OSExchangeDataTest() | 21 OSExchangeDataTest() |
| 22 : event_source_(ui::PlatformEventSource::CreateDefault()) {} | 22 : event_source_(ui::PlatformEventSource::CreateDefault()) {} |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 base::MessageLoopForUI message_loop_; | 25 base::MessageLoopForUI message_loop_; |
| 26 scoped_ptr<PlatformEventSource> event_source_; | 26 std::unique_ptr<PlatformEventSource> event_source_; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 TEST_F(OSExchangeDataTest, StringDataGetAndSet) { | 29 TEST_F(OSExchangeDataTest, StringDataGetAndSet) { |
| 30 OSExchangeData data; | 30 OSExchangeData data; |
| 31 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?"); | 31 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?"); |
| 32 EXPECT_FALSE(data.HasString()); | 32 EXPECT_FALSE(data.HasString()); |
| 33 data.SetString(input); | 33 data.SetString(input); |
| 34 EXPECT_TRUE(data.HasString()); | 34 EXPECT_TRUE(data.HasString()); |
| 35 | 35 |
| 36 OSExchangeData data2(data.provider().Clone()); | 36 OSExchangeData data2(data.provider().Clone()); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 data.SetHtml(html, url); | 178 data.SetHtml(html, url); |
| 179 | 179 |
| 180 OSExchangeData copy(data.provider().Clone()); | 180 OSExchangeData copy(data.provider().Clone()); |
| 181 base::string16 read_html; | 181 base::string16 read_html; |
| 182 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); | 182 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); |
| 183 EXPECT_EQ(html, read_html); | 183 EXPECT_EQ(html, read_html); |
| 184 } | 184 } |
| 185 #endif | 185 #endif |
| 186 | 186 |
| 187 } // namespace ui | 187 } // namespace ui |
| OLD | NEW |