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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 25894003: Don't write URLs to clipboard from views omnibox as hyperlinks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 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 | Annotate | Revision Log
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 // be available. 1607 // be available.
1608 omnibox_view->SelectAll(true); 1608 omnibox_view->SelectAll(true);
1609 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1609 EXPECT_TRUE(omnibox_view->IsSelectAll());
1610 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); 1610 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
1611 clipboard->Clear(ui::Clipboard::BUFFER_STANDARD); 1611 clipboard->Clear(ui::Clipboard::BUFFER_STANDARD);
1612 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_COPY)); 1612 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_COPY));
1613 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText()); 1613 EXPECT_EQ(ASCIIToUTF16(target_url), omnibox_view->GetText());
1614 EXPECT_TRUE(clipboard->IsFormatAvailable( 1614 EXPECT_TRUE(clipboard->IsFormatAvailable(
1615 ui::Clipboard::GetPlainTextFormatType(), ui::Clipboard::BUFFER_STANDARD)); 1615 ui::Clipboard::GetPlainTextFormatType(), ui::Clipboard::BUFFER_STANDARD));
1616 1616
1617 // The Mac is the only platform which doesn't write html. 1617 // Mac and Windows don't write HTML.
1618 #if !defined(OS_MACOSX) 1618 #if !defined(OS_MACOSX) && !defined(OS_WIN)
Peter Kasting 2013/10/05 00:42:27 Seems like on these platforms we should EXPECT_FAL
scottmg 2013/10/07 22:16:27 Done.
1619 EXPECT_TRUE(clipboard->IsFormatAvailable( 1619 EXPECT_TRUE(clipboard->IsFormatAvailable(
1620 ui::Clipboard::GetHtmlFormatType(), ui::Clipboard::BUFFER_STANDARD)); 1620 ui::Clipboard::GetHtmlFormatType(), ui::Clipboard::BUFFER_STANDARD));
1621 #endif 1621 #endif
1622 1622
1623 // These platforms should read bookmark format. 1623 // These platforms should read bookmark format.
1624 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX) 1624 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
1625 string16 title; 1625 string16 title;
1626 std::string url; 1626 std::string url;
1627 clipboard->ReadBookmark(&title, &url); 1627 clipboard->ReadBookmark(&title, &url);
1628 EXPECT_EQ(target_url, url); 1628 EXPECT_EQ(target_url, url);
(...skipping 25 matching lines...) Expand all
1654 // in the clipboard. 1654 // in the clipboard.
1655 omnibox_view->SelectAll(true); 1655 omnibox_view->SelectAll(true);
1656 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1656 EXPECT_TRUE(omnibox_view->IsSelectAll());
1657 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); 1657 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
1658 clipboard->Clear(ui::Clipboard::BUFFER_STANDARD); 1658 clipboard->Clear(ui::Clipboard::BUFFER_STANDARD);
1659 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_CUT)); 1659 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_CUT));
1660 EXPECT_EQ(string16(), omnibox_view->GetText()); 1660 EXPECT_EQ(string16(), omnibox_view->GetText());
1661 EXPECT_TRUE(clipboard->IsFormatAvailable( 1661 EXPECT_TRUE(clipboard->IsFormatAvailable(
1662 ui::Clipboard::GetPlainTextFormatType(), ui::Clipboard::BUFFER_STANDARD)); 1662 ui::Clipboard::GetPlainTextFormatType(), ui::Clipboard::BUFFER_STANDARD));
1663 1663
1664 // The Mac is the only platform which doesn't write html. 1664 // Mac and Windows don't write HTML.
1665 #if !defined(OS_MACOSX) 1665 #if !defined(OS_MACOSX) && !defined(OS_WIN)
1666 EXPECT_TRUE(clipboard->IsFormatAvailable( 1666 EXPECT_TRUE(clipboard->IsFormatAvailable(
1667 ui::Clipboard::GetHtmlFormatType(), ui::Clipboard::BUFFER_STANDARD)); 1667 ui::Clipboard::GetHtmlFormatType(), ui::Clipboard::BUFFER_STANDARD));
1668 #endif 1668 #endif
1669 1669
1670 // These platforms should read bookmark format. 1670 // These platforms should read bookmark format.
1671 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX) 1671 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
1672 string16 title; 1672 string16 title;
1673 std::string url; 1673 std::string url;
1674 clipboard->ReadBookmark(&title, &url); 1674 clipboard->ReadBookmark(&title, &url);
1675 EXPECT_EQ(target_url, url); 1675 EXPECT_EQ(target_url, url);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 omnibox_view->Update(); 1850 omnibox_view->Update();
1851 EXPECT_EQ(url_c, omnibox_view->GetText()); 1851 EXPECT_EQ(url_c, omnibox_view->GetText());
1852 } 1852 }
1853 1853
1854 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) { 1854 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) {
1855 browser()->toolbar_model()->set_search_term_replacement_enabled(false); 1855 browser()->toolbar_model()->set_search_term_replacement_enabled(false);
1856 chrome::FocusLocationBar(browser()); 1856 chrome::FocusLocationBar(browser());
1857 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); 1857 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0));
1858 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled()); 1858 EXPECT_TRUE(browser()->toolbar_model()->search_term_replacement_enabled());
1859 } 1859 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698