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

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

Issue 113403006: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 EXPECT_FALSE(omnibox_view->IsSelectAll()); 775 EXPECT_FALSE(omnibox_view->IsSelectAll());
776 776
777 // Make sure the cursor is placed correctly. 777 // Make sure the cursor is placed correctly.
778 omnibox_view->GetSelectionBounds(&start, &end); 778 omnibox_view->GetSelectionBounds(&start, &end);
779 EXPECT_EQ(old_text.size(), start); 779 EXPECT_EQ(old_text.size(), start);
780 EXPECT_EQ(old_text.size(), end); 780 EXPECT_EQ(old_text.size(), end);
781 781
782 // Insert one character at the end. Make sure we won't insert 782 // Insert one character at the end. Make sure we won't insert
783 // anything after the special ZWS mark used in gtk implementation. 783 // anything after the special ZWS mark used in gtk implementation.
784 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); 784 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0));
785 EXPECT_EQ(old_text + char16('a'), omnibox_view->GetText()); 785 EXPECT_EQ(old_text + base::char16('a'), omnibox_view->GetText());
786 786
787 // Delete one character from the end. Make sure we won't delete the special 787 // Delete one character from the end. Make sure we won't delete the special
788 // ZWS mark used in gtk implementation. 788 // ZWS mark used in gtk implementation.
789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); 789 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
790 EXPECT_EQ(old_text, omnibox_view->GetText()); 790 EXPECT_EQ(old_text, omnibox_view->GetText());
791 791
792 omnibox_view->SelectAll(true); 792 omnibox_view->SelectAll(true);
793 EXPECT_TRUE(omnibox_view->IsSelectAll()); 793 EXPECT_TRUE(omnibox_view->IsSelectAll());
794 omnibox_view->GetSelectionBounds(&start, &end); 794 omnibox_view->GetSelectionBounds(&start, &end);
795 EXPECT_EQ(0U, start); 795 EXPECT_EQ(0U, start);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 ASSERT_TRUE(omnibox_view->GetText().empty()); 853 ASSERT_TRUE(omnibox_view->GetText().empty());
854 854
855 // Revert to keyword hint mode. 855 // Revert to keyword hint mode.
856 omnibox_view->model()->ClearKeyword(base::string16()); 856 omnibox_view->model()->ClearKeyword(base::string16());
857 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); 857 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
858 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); 858 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
859 ASSERT_EQ(search_keyword, omnibox_view->GetText()); 859 ASSERT_EQ(search_keyword, omnibox_view->GetText());
860 860
861 // Keyword shouldn't be accepted by pressing space with a trailing 861 // Keyword shouldn't be accepted by pressing space with a trailing
862 // whitespace. 862 // whitespace.
863 omnibox_view->SetWindowTextAndCaretPos(search_keyword + char16(' '), 863 omnibox_view->SetWindowTextAndCaretPos(search_keyword + base::char16(' '),
864 search_keyword.length() + 1, false, false); 864 search_keyword.length() + 1, false, false);
865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); 865 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0));
866 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); 866 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
867 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); 867 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
868 ASSERT_EQ(search_keyword + ASCIIToUTF16(" "), omnibox_view->GetText()); 868 ASSERT_EQ(search_keyword + ASCIIToUTF16(" "), omnibox_view->GetText());
869 869
870 // Keyword shouldn't be accepted by deleting the trailing space. 870 // Keyword shouldn't be accepted by deleting the trailing space.
871 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); 871 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
872 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); 872 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
873 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); 873 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
874 ASSERT_EQ(search_keyword + char16(' '), omnibox_view->GetText()); 874 ASSERT_EQ(search_keyword + base::char16(' '), omnibox_view->GetText());
875 875
876 // Keyword shouldn't be accepted by pressing space before a trailing space. 876 // Keyword shouldn't be accepted by pressing space before a trailing space.
877 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0)); 877 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0));
878 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); 878 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0));
879 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); 879 ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
880 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword()); 880 ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
881 ASSERT_EQ(search_keyword + ASCIIToUTF16(" "), omnibox_view->GetText()); 881 ASSERT_EQ(search_keyword + ASCIIToUTF16(" "), omnibox_view->GetText());
882 882
883 // Keyword should be accepted by pressing space in the middle of context and 883 // Keyword should be accepted by pressing space in the middle of context and
884 // just after the keyword. 884 // just after the keyword.
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 omnibox_view->Update(); 1830 omnibox_view->Update();
1831 EXPECT_EQ(url_c, omnibox_view->GetText()); 1831 EXPECT_EQ(url_c, omnibox_view->GetText());
1832 } 1832 }
1833 1833
1834 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) { 1834 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, InputResetsSearchTermReplacement) {
1835 browser()->toolbar_model()->set_url_replacement_enabled(false); 1835 browser()->toolbar_model()->set_url_replacement_enabled(false);
1836 chrome::FocusLocationBar(browser()); 1836 chrome::FocusLocationBar(browser());
1837 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); 1837 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0));
1838 EXPECT_TRUE(browser()->toolbar_model()->url_replacement_enabled()); 1838 EXPECT_TRUE(browser()->toolbar_model()->url_replacement_enabled());
1839 } 1839 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698