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

Unified Diff: chrome/browser/ui/omnibox/omnibox_view_unittest.cc

Issue 20501002: Adds paste function to searchbox api and handles paste event on fakebox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/omnibox/omnibox_view_unittest.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_view_unittest.cc b/chrome/browser/ui/omnibox/omnibox_view_unittest.cc
index c00574bd44bd36baf1d7bf47e6bd1ca19e40924f..24607d3114eeb4a8791a4a604546611785553835 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_unittest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_unittest.cc
@@ -44,6 +44,26 @@ TEST_F(OmniboxViewTest, TestStripSchemasUnsafeForPaste) {
}
}
+TEST_F(OmniboxViewTest, SanitizeTextForPaste) {
+ // Broken URL has newlines stripped.
+ const string16 kWrappedURL(ASCIIToUTF16(
+ "http://www.chromium.org/developers/testing/chromium-\n"
+ "build-infrastructure/tour-of-the-chromium-buildbot"));
+
+ const string16 kFixedURL(ASCIIToUTF16(
+ "http://www.chromium.org/developers/testing/chromium-"
+ "build-infrastructure/tour-of-the-chromium-buildbot"));
+ EXPECT_EQ(kFixedURL, OmniboxView::SanitizeTextForPaste(kWrappedURL));
+
+ // Multi-line address is converted to a single-line address.
+ const string16 kWrappedAddress(ASCIIToUTF16(
+ "1600 Amphitheatre Parkway\nMountain View, CA"));
+
+ const string16 kFixedAddress(ASCIIToUTF16(
+ "1600 Amphitheatre Parkway Mountain View, CA"));
+ EXPECT_EQ(kFixedAddress, OmniboxView::SanitizeTextForPaste(kWrappedAddress));
+}
+
TEST_F(OmniboxViewTest, GetClipboardText) {
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
@@ -107,34 +127,6 @@ TEST_F(OmniboxViewTest, GetClipboardText) {
clipboard_writer.WriteHTML(kMarkup, kURL);
}
EXPECT_TRUE(OmniboxView::GetClipboardText().empty());
-
- // Broken URL has newlines stripped.
- {
- const string16 kWrappedURL(ASCIIToUTF16(
- "http://www.chromium.org/developers/testing/chromium-\n"
- "build-infrastructure/tour-of-the-chromium-buildbot"));
- ui::ScopedClipboardWriter clipboard_writer(clipboard,
- ui::Clipboard::BUFFER_STANDARD);
- clipboard_writer.WriteText(kWrappedURL);
- }
-
- const string16 kFixedURL(ASCIIToUTF16(
- "http://www.chromium.org/developers/testing/chromium-"
- "build-infrastructure/tour-of-the-chromium-buildbot"));
- EXPECT_EQ(kFixedURL, OmniboxView::GetClipboardText());
-
- // Multi-line address is converted to a single-line address.
- {
- const string16 kWrappedAddress(ASCIIToUTF16(
- "1600 Amphitheatre Parkway\nMountain View, CA"));
- ui::ScopedClipboardWriter clipboard_writer(clipboard,
- ui::Clipboard::BUFFER_STANDARD);
- clipboard_writer.WriteText(kWrappedAddress);
- }
-
- const string16 kFixedAddress(ASCIIToUTF16(
- "1600 Amphitheatre Parkway Mountain View, CA"));
- EXPECT_EQ(kFixedAddress, OmniboxView::GetClipboardText());
}
} // namespace
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698