Chromium Code Reviews| Index: components/bookmarks/browser/bookmark_utils_unittest.cc |
| diff --git a/components/bookmarks/browser/bookmark_utils_unittest.cc b/components/bookmarks/browser/bookmark_utils_unittest.cc |
| index 75daeebb6c668562c9f6a2df424c6139382f0f58..ebaf3e9233e298756fc8f865c6ea09eca63aa789 100644 |
| --- a/components/bookmarks/browser/bookmark_utils_unittest.cc |
| +++ b/components/bookmarks/browser/bookmark_utils_unittest.cc |
| @@ -273,6 +273,25 @@ TEST_F(BookmarkUtilsTest, CopyPaste) { |
| // And make sure we can paste a bookmark from the clipboard. |
| EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->bookmark_bar_node())); |
| + // Write some valid url to the clipboard. |
|
sky
2014/09/08 16:26:18
Move your new assertions into their own test. Putt
|
| + ui::ScopedClipboardWriter clipboard_writer( |
| + ui::Clipboard::GetForCurrentThread(), ui::CLIPBOARD_TYPE_COPY_PASTE); |
| + clipboard_writer.WriteText(ASCIIToUTF16("http://www.google.com")); |
| + |
| + // Now we should be able to paste from the clipboard. |
| + EXPECT_TRUE(CanPasteFromClipboard(model.get(), model->bookmark_bar_node())); |
| + |
| + // Write blank text to clipboard. |
| + { |
| + ui::ScopedClipboardWriter clipboard_writer( |
| + ui::Clipboard::GetForCurrentThread(), |
| + ui::CLIPBOARD_TYPE_COPY_PASTE); |
| + clipboard_writer.WriteText(ASCIIToUTF16("")); |
| + } |
| + |
| + // Now we shouldn't be able to paste from the clipboard. |
| + EXPECT_FALSE(CanPasteFromClipboard(model.get(), model->bookmark_bar_node())); |
| + |
| // Write some text to the clipboard. |
| { |
| ui::ScopedClipboardWriter clipboard_writer( |
| @@ -311,6 +330,21 @@ TEST_F(BookmarkUtilsTest, CopyPasteMetaInfo) { |
| PasteFromClipboard(model.get(), folder, 0); |
| ASSERT_EQ(1, folder->child_count()); |
| + // Write some valid url to clipboard |
|
sky
2014/09/08 16:26:18
end with '.'
|
| + base::string16 url_text = ASCIIToUTF16("http://www.google.com/"); |
|
sky
2014/09/08 16:26:18
you've got two spaces here. And make url_text a co
|
| + ui::ScopedClipboardWriter clipboard_writer( |
| + ui::Clipboard::GetForCurrentThread(), ui::CLIPBOARD_TYPE_COPY_PASTE); |
| + clipboard_writer.WriteText(url_text); |
| + |
| + // We should be able to paste from clipboard. |
| + EXPECT_TRUE(CanPasteFromClipboard(model.get(), folder)); |
| + |
| + PasteFromClipboard(model.get(), folder, 1); |
| + ASSERT_EQ(2, folder->child_count()); |
| + |
| + // Url for added node should be same as url_text. |
| + EXPECT_EQ(url_text,ASCIIToUTF16(folder->GetChild(1)->url().spec())); |
|
sky
2014/09/08 16:26:18
nit: space after ','
|
| + |
| // Verify that the pasted node contains the same meta info. |
| const BookmarkNode* pasted = folder->GetChild(0); |
| ASSERT_TRUE(pasted->GetMetaInfoMap()); |