Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/search_engines/template_url_service_factory.h" | 8 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/location_bar/location_bar.h" | 12 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 13 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 13 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 14 #include "chrome/browser/ui/view_ids.h" | 14 #include "chrome/browser/ui/view_ids.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chrome/test/base/interactive_test_utils.h" | 20 #include "chrome/test/base/interactive_test_utils.h" |
| 21 #include "ui/base/clipboard/clipboard.h" | 21 #include "ui/base/clipboard/clipboard.h" |
| 22 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 22 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 23 #include "ui/base/ime/text_input_focus_manager.h" | |
| 24 #include "ui/base/test/ui_controls.h" | 23 #include "ui/base/test/ui_controls.h" |
| 25 #include "ui/base/ui_base_switches.h" | 24 #include "ui/base/ui_base_switches.h" |
| 26 #include "ui/events/event_processor.h" | 25 #include "ui/events/event_processor.h" |
| 27 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 28 #include "ui/events/test/event_generator.h" | 27 #include "ui/events/test/event_generator.h" |
| 29 #include "ui/views/controls/textfield/textfield_test_api.h" | 28 #include "ui/views/controls/textfield/textfield_test_api.h" |
| 30 | 29 |
| 31 namespace { | 30 namespace { |
| 32 | 31 |
| 33 void SetClipboardText(ui::ClipboardType type, const std::string& text) { | 32 void SetClipboardText(ui::ClipboardType type, const std::string& text) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 Tap(omnibox_center, omnibox_center); | 367 Tap(omnibox_center, omnibox_center); |
| 369 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); | 368 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); |
| 370 | 369 |
| 371 // Execute a command and check if it deactivate touch editing. Paste & Go is | 370 // Execute a command and check if it deactivate touch editing. Paste & Go is |
| 372 // chosen since it is specific to Omnibox and its execution wouldn't be | 371 // chosen since it is specific to Omnibox and its execution wouldn't be |
| 373 // delgated to the base Textfield class. | 372 // delgated to the base Textfield class. |
| 374 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); | 373 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); |
| 375 EXPECT_FALSE(textfield_test_api.touch_selection_controller()); | 374 EXPECT_FALSE(textfield_test_api.touch_selection_controller()); |
| 376 } | 375 } |
| 377 | 376 |
| 378 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FocusedTextInputClient) { | |
|
Yuki
2015/06/15 04:34:29
I think we want to pass this test regardless of wh
Shu Chen
2015/06/15 05:06:49
Done.
| |
| 379 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 380 cmd_line->AppendSwitch(switches::kEnableTextInputFocusManager); | |
| 381 | |
| 382 // TODO(yukishiino): The following call to FocusLocationBar is not necessary | |
| 383 // if the flag is enabled by default. Remove the call once the transition to | |
| 384 // TextInputFocusManager completes. | |
| 385 chrome::FocusLocationBar(browser()); | |
| 386 OmniboxView* view = NULL; | |
| 387 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | |
| 388 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | |
| 389 ui::TextInputFocusManager* text_input_focus_manager = | |
| 390 ui::TextInputFocusManager::GetInstance(); | |
| 391 EXPECT_EQ(omnibox_view_views->GetTextInputClient(), | |
| 392 text_input_focus_manager->GetFocusedTextInputClient()); | |
| 393 } | |
| OLD | NEW |