Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Side by Side Diff: ui/base/clipboard/clipboard_unittest.cc

Issue 10539028: Only paste the fragment of text which was copied to the clipboard. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/tests/test_flash_clipboard.cc ('k') | ui/base/clipboard/clipboard_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ppapi/tests/test_flash_clipboard.cc ('k') | ui/base/clipboard/clipboard_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698