| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
| 9 #include "base/message_loop.h" |
| 9 #include "base/scoped_clipboard_writer.h" | 10 #include "base/scoped_clipboard_writer.h" |
| 10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 13 | 14 |
| 15 #if defined(OS_WIN) |
| 16 class ClipboardTest : public PlatformTest { |
| 17 protected: |
| 18 virtual void SetUp() { |
| 19 message_loop_.reset(new MessageLoopForUI()); |
| 20 } |
| 21 virtual void TearDown() { |
| 22 } |
| 23 |
| 24 private: |
| 25 scoped_ptr<MessageLoop> message_loop_; |
| 26 }; |
| 27 #elif defined(OS_POSIX) |
| 14 typedef PlatformTest ClipboardTest; | 28 typedef PlatformTest ClipboardTest; |
| 29 #endif // defined(OS_WIN) |
| 15 | 30 |
| 16 TEST_F(ClipboardTest, ClearTest) { | 31 TEST_F(ClipboardTest, ClearTest) { |
| 17 Clipboard clipboard; | 32 Clipboard clipboard; |
| 18 | 33 |
| 19 { | 34 { |
| 20 ScopedClipboardWriter clipboard_writer(&clipboard); | 35 ScopedClipboardWriter clipboard_writer(&clipboard); |
| 21 clipboard_writer.WriteText(std::wstring(L"clear me")); | 36 clipboard_writer.WriteText(std::wstring(L"clear me")); |
| 22 } | 37 } |
| 23 | 38 |
| 24 { | 39 { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 { | 272 { |
| 258 ScopedClipboardWriter clipboard_writer(&clipboard); | 273 ScopedClipboardWriter clipboard_writer(&clipboard); |
| 259 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); | 274 clipboard_writer.WriteBitmapFromPixels(fake_bitmap, gfx::Size(3, 4)); |
| 260 } | 275 } |
| 261 | 276 |
| 262 EXPECT_EQ(true, clipboard.IsFormatAvailable( | 277 EXPECT_EQ(true, clipboard.IsFormatAvailable( |
| 263 Clipboard::GetBitmapFormatType())); | 278 Clipboard::GetBitmapFormatType())); |
| 264 } | 279 } |
| 265 #endif // defined(OS_WIN) | 280 #endif // defined(OS_WIN) |
| 266 | 281 |
| OLD | NEW |