| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(), | 219 EXPECT_TRUE(clipboard.IsFormatAvailable(Clipboard::GetHtmlFormatType(), |
| 220 Clipboard::BUFFER_STANDARD)); | 220 Clipboard::BUFFER_STANDARD)); |
| 221 uint32 fragment_start; | 221 uint32 fragment_start; |
| 222 uint32 fragment_end; | 222 uint32 fragment_end; |
| 223 clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result, | 223 clipboard.ReadHTML(Clipboard::BUFFER_STANDARD, &markup_result, &url_result, |
| 224 &fragment_start, &fragment_end); | 224 &fragment_start, &fragment_end); |
| 225 EXPECT_PRED2(MarkupMatches, markup, markup_result); | 225 EXPECT_PRED2(MarkupMatches, markup, markup_result); |
| 226 EXPECT_EQ(url, url_result); | 226 EXPECT_EQ(url, url_result); |
| 227 // Make sure that fragment indices were adjusted when converting. | 227 // Make sure that fragment indices were adjusted when converting. |
| 228 EXPECT_EQ(36, fragment_start); | 228 EXPECT_EQ(36, fragment_start); |
| 229 EXPECT_EQ(56, fragment_end); | 229 EXPECT_EQ(52, fragment_end); |
| 230 } | 230 } |
| 231 #endif // defined(OS_WIN) | 231 #endif // defined(OS_WIN) |
| 232 | 232 |
| 233 #if defined(TOOLKIT_GTK) | 233 #if defined(TOOLKIT_GTK) |
| 234 // Regression test for crbug.com/56298 (pasting empty HTML crashes Linux). | 234 // Regression test for crbug.com/56298 (pasting empty HTML crashes Linux). |
| 235 TEST_F(ClipboardTest, EmptyHTMLTest) { | 235 TEST_F(ClipboardTest, EmptyHTMLTest) { |
| 236 Clipboard clipboard; | 236 Clipboard clipboard; |
| 237 // ScopedClipboardWriter doesn't let us write empty data to the clipboard. | 237 // ScopedClipboardWriter doesn't let us write empty data to the clipboard. |
| 238 clipboard.clipboard_data_ = new Clipboard::TargetMap(); | 238 clipboard.clipboard_data_ = new Clipboard::TargetMap(); |
| 239 // The 1 is so the compiler doesn't warn about allocating an empty array. | 239 // The 1 is so the compiler doesn't warn about allocating an empty array. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 writer.WriteBookmark(UTF8ToUTF16("foo"), "bar"); | 643 writer.WriteBookmark(UTF8ToUTF16("foo"), "bar"); |
| 644 writer.WriteHyperlink(ASCIIToUTF16("foo"), "bar"); | 644 writer.WriteHyperlink(ASCIIToUTF16("foo"), "bar"); |
| 645 writer.WriteWebSmartPaste(); | 645 writer.WriteWebSmartPaste(); |
| 646 // Left out: WriteFile, WriteFiles, WriteBitmapFromPixels, WritePickledData. | 646 // Left out: WriteFile, WriteFiles, WriteBitmapFromPixels, WritePickledData. |
| 647 } | 647 } |
| 648 | 648 |
| 649 // Passes if we don't crash. | 649 // Passes if we don't crash. |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace ui | 652 } // namespace ui |
| OLD | NEW |