Commit 8a251470 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Remove Cocoa Affordances from Omnibox interactive_ui_tests

This change fixes changes some platform checks to TOOLKIT_VIEWS and
allows the test to assume that Mac is always running with views
enabled.

Also the information about undo selection restoration has been moved
to http://crbug.com/836490.

BUG=834754,836490

Change-Id: I906e78fb4649c646f79c2d18e6d4222b7a25050d
Reviewed-on: https://chromium-review.googlesource.com/1026881Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553623}
parent 2c1a8668
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/search_test_utils.h" #include "chrome/test/base/search_test_utils.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/views/scoped_macviews_browser_mode.cc"
#include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/bookmarks/test/bookmark_test_helpers.h"
...@@ -373,6 +374,8 @@ class OmniboxViewTest : public InProcessBrowserTest, ...@@ -373,6 +374,8 @@ class OmniboxViewTest : public InProcessBrowserTest,
} }
private: private:
test::ScopedMacViewsBrowserMode views_mode_{true};
// Non-owning pointer. // Non-owning pointer.
TestToolbarModel* test_toolbar_model_ = nullptr; TestToolbarModel* test_toolbar_model_ = nullptr;
...@@ -815,7 +818,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) { ...@@ -815,7 +818,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) {
size_t start, end; size_t start, end;
omnibox_view->GetSelectionBounds(&start, &end); omnibox_view->GetSelectionBounds(&start, &end);
#if defined(OS_WIN) || defined(OS_LINUX) #if defined(TOOLKIT_VIEWS)
// Views textfields select-all in reverse to show the leading text. // Views textfields select-all in reverse to show the leading text.
std::swap(start, end); std::swap(start, end);
#endif #endif
...@@ -847,7 +850,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) { ...@@ -847,7 +850,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) {
omnibox_view->SelectAll(true); omnibox_view->SelectAll(true);
EXPECT_TRUE(omnibox_view->IsSelectAll()); EXPECT_TRUE(omnibox_view->IsSelectAll());
omnibox_view->GetSelectionBounds(&start, &end); omnibox_view->GetSelectionBounds(&start, &end);
#if defined(OS_WIN) || defined(OS_LINUX) #if defined(TOOLKIT_VIEWS)
// Views textfields select-all in reverse to show the leading text. // Views textfields select-all in reverse to show the leading text.
std::swap(start, end); std::swap(start, end);
#endif #endif
...@@ -1394,11 +1397,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_TabAcceptKeyword) { ...@@ -1394,11 +1397,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_TabAcceptKeyword) {
ASSERT_TRUE(omnibox_view->GetText().empty()); ASSERT_TRUE(omnibox_view->GetText().empty());
// Revert to keyword hint mode with SHIFT+TAB. // Revert to keyword hint mode with SHIFT+TAB.
#if defined(OS_MACOSX)
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACKTAB, 0));
#else
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN));
#endif
ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
ASSERT_EQ(text, omnibox_view->model()->keyword()); ASSERT_EQ(text, omnibox_view->model()->keyword());
ASSERT_EQ(text, omnibox_view->GetText()); ASSERT_EQ(text, omnibox_view->GetText());
...@@ -1605,16 +1604,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedo) { ...@@ -1605,16 +1604,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedo) {
SendKey(ui::VKEY_Z, kCtrlOrCmdMask | ui::EF_SHIFT_DOWN)); SendKey(ui::VKEY_Z, kCtrlOrCmdMask | ui::EF_SHIFT_DOWN));
EXPECT_TRUE(omnibox_view->GetText().empty()); EXPECT_TRUE(omnibox_view->GetText().empty());
// The toolkit-views undo manager doesn't support restoring selection. Cocoa // Perform an undo.
// does, so it needs to be cleared.
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, kCtrlOrCmdMask)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, kCtrlOrCmdMask));
#if defined(OS_MACOSX)
// TODO(tapted): This next line may fail if running a toolkit-views browser
// window on Mac. We should fix the toolkit-views undo manager to restore
// selection rather than deleting this #ifdef.
EXPECT_TRUE(omnibox_view->IsSelectAll());
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, 0));
#endif
EXPECT_FALSE(omnibox_view->IsSelectAll()); EXPECT_FALSE(omnibox_view->IsSelectAll());
// The cursor should be at the end. // The cursor should be at the end.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment