| OLD | NEW |
| 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 EXPECT_EQ(old_selected_line, popup_model->selected_line()); | 727 EXPECT_EQ(old_selected_line, popup_model->selected_line()); |
| 728 } | 728 } |
| 729 | 729 |
| 730 // http://crbug.com/131179, http://crbug.com/146619 | 730 // http://crbug.com/131179, http://crbug.com/146619 |
| 731 #if defined(OS_LINUX) || defined(OS_WIN) | 731 #if defined(OS_LINUX) || defined(OS_WIN) |
| 732 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations | 732 #define MAYBE_BasicTextOperations DISABLED_BasicTextOperations |
| 733 #else | 733 #else |
| 734 #define MAYBE_BasicTextOperations BasicTextOperations | 734 #define MAYBE_BasicTextOperations BasicTextOperations |
| 735 #endif | 735 #endif |
| 736 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) { | 736 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_BasicTextOperations) { |
| 737 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); | 737 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
| 738 chrome::FocusLocationBar(browser()); | 738 chrome::FocusLocationBar(browser()); |
| 739 | 739 |
| 740 OmniboxView* omnibox_view = NULL; | 740 OmniboxView* omnibox_view = NULL; |
| 741 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 741 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 742 | 742 |
| 743 base::string16 old_text = omnibox_view->GetText(); | 743 base::string16 old_text = omnibox_view->GetText(); |
| 744 EXPECT_EQ(base::UTF8ToUTF16(content::kAboutBlankURL), old_text); | 744 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text); |
| 745 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 745 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 746 | 746 |
| 747 size_t start, end; | 747 size_t start, end; |
| 748 omnibox_view->GetSelectionBounds(&start, &end); | 748 omnibox_view->GetSelectionBounds(&start, &end); |
| 749 EXPECT_EQ(0U, start); | 749 EXPECT_EQ(0U, start); |
| 750 EXPECT_EQ(old_text.size(), end); | 750 EXPECT_EQ(old_text.size(), end); |
| 751 | 751 |
| 752 // Move the cursor to the end. | 752 // Move the cursor to the end. |
| 753 #if defined(OS_MACOSX) | 753 #if defined(OS_MACOSX) |
| 754 // End doesn't work on Mac trybot. | 754 // End doesn't work on Mac trybot. |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 #else | 1059 #else |
| 1060 #define MAYBE_DeleteItem DeleteItem | 1060 #define MAYBE_DeleteItem DeleteItem |
| 1061 #endif | 1061 #endif |
| 1062 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DeleteItem) { | 1062 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_DeleteItem) { |
| 1063 // Disable the search provider, to make sure the popup contains only history | 1063 // Disable the search provider, to make sure the popup contains only history |
| 1064 // items. | 1064 // items. |
| 1065 TemplateURLService* model = | 1065 TemplateURLService* model = |
| 1066 TemplateURLServiceFactory::GetForProfile(browser()->profile()); | 1066 TemplateURLServiceFactory::GetForProfile(browser()->profile()); |
| 1067 model->SetUserSelectedDefaultSearchProvider(NULL); | 1067 model->SetUserSelectedDefaultSearchProvider(NULL); |
| 1068 | 1068 |
| 1069 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); | 1069 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
| 1070 chrome::FocusLocationBar(browser()); | 1070 chrome::FocusLocationBar(browser()); |
| 1071 | 1071 |
| 1072 OmniboxView* omnibox_view = NULL; | 1072 OmniboxView* omnibox_view = NULL; |
| 1073 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1073 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1074 | 1074 |
| 1075 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); | 1075 OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); |
| 1076 ASSERT_TRUE(popup_model); | 1076 ASSERT_TRUE(popup_model); |
| 1077 | 1077 |
| 1078 base::string16 old_text = omnibox_view->GetText(); | 1078 base::string16 old_text = omnibox_view->GetText(); |
| 1079 | 1079 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 | 1364 |
| 1365 // Press ctrl key. | 1365 // Press ctrl key. |
| 1366 omnibox_view->model()->OnControlKeyChanged(true); | 1366 omnibox_view->model()->OnControlKeyChanged(true); |
| 1367 | 1367 |
| 1368 // Inline autocomplete should still be there. | 1368 // Inline autocomplete should still be there. |
| 1369 EXPECT_EQ(old_text, omnibox_view->GetText()); | 1369 EXPECT_EQ(old_text, omnibox_view->GetText()); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 #if defined(TOOLKIT_VIEWS) | 1372 #if defined(TOOLKIT_VIEWS) |
| 1373 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedo) { | 1373 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedo) { |
| 1374 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); | 1374 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
| 1375 chrome::FocusLocationBar(browser()); | 1375 chrome::FocusLocationBar(browser()); |
| 1376 | 1376 |
| 1377 OmniboxView* omnibox_view = NULL; | 1377 OmniboxView* omnibox_view = NULL; |
| 1378 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); | 1378 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); |
| 1379 | 1379 |
| 1380 base::string16 old_text = omnibox_view->GetText(); | 1380 base::string16 old_text = omnibox_view->GetText(); |
| 1381 EXPECT_EQ(base::UTF8ToUTF16(content::kAboutBlankURL), old_text); | 1381 EXPECT_EQ(base::UTF8ToUTF16(url::kAboutBlankURL), old_text); |
| 1382 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 1382 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
| 1383 | 1383 |
| 1384 // Delete the text, then undo. | 1384 // Delete the text, then undo. |
| 1385 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); | 1385 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); |
| 1386 EXPECT_TRUE(omnibox_view->GetText().empty()); | 1386 EXPECT_TRUE(omnibox_view->GetText().empty()); |
| 1387 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); | 1387 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); |
| 1388 EXPECT_EQ(old_text, omnibox_view->GetText()); | 1388 EXPECT_EQ(old_text, omnibox_view->GetText()); |
| 1389 | 1389 |
| 1390 // Redo should delete the text again. | 1390 // Redo should delete the text again. |
| 1391 ASSERT_NO_FATAL_FAILURE( | 1391 ASSERT_NO_FATAL_FAILURE( |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 omnibox_view->Update(); | 1781 omnibox_view->Update(); |
| 1782 EXPECT_EQ(url_c, omnibox_view->GetText()); | 1782 EXPECT_EQ(url_c, omnibox_view->GetText()); |
| 1783 } | 1783 } |
| 1784 | 1784 |
| 1785 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { | 1785 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscDisablesSearchTermReplacement) { |
| 1786 browser()->toolbar_model()->set_url_replacement_enabled(true); | 1786 browser()->toolbar_model()->set_url_replacement_enabled(true); |
| 1787 chrome::FocusLocationBar(browser()); | 1787 chrome::FocusLocationBar(browser()); |
| 1788 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); | 1788 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); |
| 1789 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); | 1789 EXPECT_FALSE(browser()->toolbar_model()->url_replacement_enabled()); |
| 1790 } | 1790 } |
| OLD | NEW |