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

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

Issue 10412009: Enable disabled omnibox tests on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, 1347 IN_PROC_BROWSER_TEST_F(OmniboxViewTest,
1348 PersistKeywordModeOnTabSwitch) { 1348 PersistKeywordModeOnTabSwitch) {
1349 PersistKeywordModeOnTabSwitch(); 1349 PersistKeywordModeOnTabSwitch();
1350 } 1350 }
1351 1351
1352 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, 1352 IN_PROC_BROWSER_TEST_F(OmniboxViewTest,
1353 CtrlKeyPressedWithInlineAutocompleteTest) { 1353 CtrlKeyPressedWithInlineAutocompleteTest) {
1354 CtrlKeyPressedWithInlineAutocompleteTest(); 1354 CtrlKeyPressedWithInlineAutocompleteTest();
1355 } 1355 }
1356 1356
1357 #if defined(TOOLKIT_GTK) 1357 #if defined(TOOLKIT_GTK) || defined(USE_AURA)
1358 // TODO(oshima): enable these tests for views-implmentation when 1358 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedo) {
1359 // these featuers are supported. http://crbug.com/121558.
1360
1361 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedoLinux) {
1362 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); 1359 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
1363 browser()->FocusLocationBar(); 1360 browser()->FocusLocationBar();
1364 1361
1365 OmniboxView* omnibox_view = NULL; 1362 OmniboxView* omnibox_view = NULL;
1366 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 1363 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1367 1364
1368 string16 old_text = omnibox_view->GetText(); 1365 string16 old_text = omnibox_view->GetText();
1369 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), old_text); 1366 EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), old_text);
1370 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1367 EXPECT_TRUE(omnibox_view->IsSelectAll());
1371 1368
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 1413
1417 // Undo delete two characters. 1414 // Undo delete two characters.
1418 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); 1415 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN));
1419 EXPECT_EQ(old_text, omnibox_view->GetText()); 1416 EXPECT_EQ(old_text, omnibox_view->GetText());
1420 1417
1421 // Undo again. 1418 // Undo again.
1422 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); 1419 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN));
1423 EXPECT_TRUE(omnibox_view->GetText().empty()); 1420 EXPECT_TRUE(omnibox_view->GetText().empty());
1424 } 1421 }
1425 1422
1423 // See http://crosbug.com/10306
1424 IN_PROC_BROWSER_TEST_F(OmniboxViewTest,
1425 BackspaceDeleteHalfWidthKatakana) {
1426 OmniboxView* omnibox_view = NULL;
1427 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1428 // Insert text: ダ
1429 omnibox_view->SetUserText(UTF8ToUTF16("\357\276\200\357\276\236"));
1430
1431 // Move the cursor to the end.
1432 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0));
1433
1434 // Backspace should delete one character.
1435 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
1436 EXPECT_EQ(UTF8ToUTF16("\357\276\200"), omnibox_view->GetText());
1437 }
1438
1439 #endif // defined(TOOLKIT_GTK) || defined(USE_AURA)
1440
1441 #if defined(TOOLKIT_GTK)
1426 // See http://crbug.com/63860 1442 // See http://crbug.com/63860
1427 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PrimarySelection) { 1443 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PrimarySelection) {
1428 OmniboxView* omnibox_view = NULL; 1444 OmniboxView* omnibox_view = NULL;
1429 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 1445 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1430 omnibox_view->SetUserText(ASCIIToUTF16("Hello world")); 1446 omnibox_view->SetUserText(ASCIIToUTF16("Hello world"));
1431 EXPECT_FALSE(omnibox_view->IsSelectAll()); 1447 EXPECT_FALSE(omnibox_view->IsSelectAll());
1432 1448
1433 // Move the cursor to the end. 1449 // Move the cursor to the end.
1434 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); 1450 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0));
1435 1451
1436 // Select all text by pressing Shift+Home 1452 // Select all text by pressing Shift+Home
1437 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_HOME, ui::EF_SHIFT_DOWN)); 1453 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_HOME, ui::EF_SHIFT_DOWN));
1438 EXPECT_TRUE(omnibox_view->IsSelectAll()); 1454 EXPECT_TRUE(omnibox_view->IsSelectAll());
1439 1455
1440 // The selected content should be saved to the PRIMARY clipboard. 1456 // The selected content should be saved to the PRIMARY clipboard.
1441 EXPECT_EQ("Hello world", GetPrimarySelectionText()); 1457 EXPECT_EQ("Hello world", GetPrimarySelectionText());
1442 1458
1443 // Move the cursor to the end. 1459 // Move the cursor to the end.
1444 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); 1460 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0));
1445 EXPECT_FALSE(omnibox_view->IsSelectAll()); 1461 EXPECT_FALSE(omnibox_view->IsSelectAll());
1446 1462
1447 // The content in the PRIMARY clipboard should not be cleared. 1463 // The content in the PRIMARY clipboard should not be cleared.
1448 EXPECT_EQ("Hello world", GetPrimarySelectionText()); 1464 EXPECT_EQ("Hello world", GetPrimarySelectionText());
1449 } 1465 }
1450 1466
1451 // See http://crosbug.com/10306
1452 IN_PROC_BROWSER_TEST_F(OmniboxViewTest,
1453 BackspaceDeleteHalfWidthKatakana) {
1454 OmniboxView* omnibox_view = NULL;
1455 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1456 // Insert text: ダ
1457 omnibox_view->SetUserText(UTF8ToUTF16("\357\276\200\357\276\236"));
1458
1459 // Move the cursor to the end.
1460 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0));
1461
1462 // Backspace should delete one character.
1463 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
1464 EXPECT_EQ(UTF8ToUTF16("\357\276\200"), omnibox_view->GetText());
1465 }
1466
1467 // http://crbug.com/12316 1467 // http://crbug.com/12316
1468 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PasteReplacingAll) { 1468 IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PasteReplacingAll) {
1469 OmniboxView* omnibox_view = NULL; 1469 OmniboxView* omnibox_view = NULL;
1470 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); 1470 ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
1471 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); 1471 AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model();
1472 ASSERT_TRUE(popup_model); 1472 ASSERT_TRUE(popup_model);
1473 1473
1474 SetClipboardText(kSearchText); 1474 SetClipboardText(kSearchText);
1475 1475
1476 // Paste text. 1476 // Paste text.
1477 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN)); 1477 ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, ui::EF_CONTROL_DOWN));
1478 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); 1478 ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
1479 ASSERT_TRUE(popup_model->IsOpen()); 1479 ASSERT_TRUE(popup_model->IsOpen());
1480 1480
1481 // Inline autocomplete shouldn't be triggered. 1481 // Inline autocomplete shouldn't be triggered.
1482 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); 1482 ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText());
1483 } 1483 }
1484 #endif 1484 #endif // defined(TOOLKIT_GTK)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698