| 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" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViewsTest); | 100 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViewsTest); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, PasteAndGoDoesNotLeavePopupOpen) { | 103 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, PasteAndGoDoesNotLeavePopupOpen) { |
| 104 OmniboxView* view = NULL; | 104 OmniboxView* view = NULL; |
| 105 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | 105 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); |
| 106 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 106 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
| 107 | 107 |
| 108 // Put an URL on the clipboard. | 108 // Put an URL on the clipboard. |
| 109 { | 109 { |
| 110 ui::ScopedClipboardWriter clipboard_writer( | 110 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_COPY_PASTE); |
| 111 ui::Clipboard::GetForCurrentThread(), ui::CLIPBOARD_TYPE_COPY_PASTE); | |
| 112 clipboard_writer.WriteURL(base::ASCIIToUTF16("http://www.example.com/")); | 111 clipboard_writer.WriteURL(base::ASCIIToUTF16("http://www.example.com/")); |
| 113 } | 112 } |
| 114 | 113 |
| 115 // Paste and go. | 114 // Paste and go. |
| 116 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); | 115 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); |
| 117 | 116 |
| 118 // The popup should not be open. | 117 // The popup should not be open. |
| 119 EXPECT_FALSE(view->model()->popup_model()->IsOpen()); | 118 EXPECT_FALSE(view->model()->popup_model()->IsOpen()); |
| 120 } | 119 } |
| 121 | 120 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 299 |
| 301 OmniboxView* view = NULL; | 300 OmniboxView* view = NULL; |
| 302 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | 301 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); |
| 303 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 302 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
| 304 views::TextfieldTestApi textfield_test_api(omnibox_view_views); | 303 views::TextfieldTestApi textfield_test_api(omnibox_view_views); |
| 305 | 304 |
| 306 // Put a URL on the clipboard. It is written to the clipboard upon destruction | 305 // Put a URL on the clipboard. It is written to the clipboard upon destruction |
| 307 // of the writer. | 306 // of the writer. |
| 308 { | 307 { |
| 309 ui::ScopedClipboardWriter clipboard_writer( | 308 ui::ScopedClipboardWriter clipboard_writer( |
| 310 ui::Clipboard::GetForCurrentThread(), | |
| 311 ui::CLIPBOARD_TYPE_COPY_PASTE); | 309 ui::CLIPBOARD_TYPE_COPY_PASTE); |
| 312 clipboard_writer.WriteURL(base::ASCIIToUTF16("http://www.example.com/")); | 310 clipboard_writer.WriteURL(base::ASCIIToUTF16("http://www.example.com/")); |
| 313 } | 311 } |
| 314 | 312 |
| 315 // Tap to activate touch editing. | 313 // Tap to activate touch editing. |
| 316 gfx::Point omnibox_center = | 314 gfx::Point omnibox_center = |
| 317 omnibox_view_views->GetBoundsInScreen().CenterPoint(); | 315 omnibox_view_views->GetBoundsInScreen().CenterPoint(); |
| 318 Tap(omnibox_center, omnibox_center); | 316 Tap(omnibox_center, omnibox_center); |
| 319 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); | 317 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); |
| 320 | 318 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 334 // TextInputFocusManager completes. | 332 // TextInputFocusManager completes. |
| 335 chrome::FocusLocationBar(browser()); | 333 chrome::FocusLocationBar(browser()); |
| 336 OmniboxView* view = NULL; | 334 OmniboxView* view = NULL; |
| 337 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); | 335 ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &view)); |
| 338 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); | 336 OmniboxViewViews* omnibox_view_views = static_cast<OmniboxViewViews*>(view); |
| 339 ui::TextInputFocusManager* text_input_focus_manager = | 337 ui::TextInputFocusManager* text_input_focus_manager = |
| 340 ui::TextInputFocusManager::GetInstance(); | 338 ui::TextInputFocusManager::GetInstance(); |
| 341 EXPECT_EQ(omnibox_view_views->GetTextInputClient(), | 339 EXPECT_EQ(omnibox_view_views->GetTextInputClient(), |
| 342 text_input_focus_manager->GetFocusedTextInputClient()); | 340 text_input_focus_manager->GetFocusedTextInputClient()); |
| 343 } | 341 } |
| OLD | NEW |