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 "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/omnibox/location_bar.h" | 10 #include "chrome/browser/ui/omnibox/location_bar.h" |
11 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 11 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
12 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
13 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/interactive_test_utils.h" | 16 #include "chrome/test/base/interactive_test_utils.h" |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
17 #include "ui/aura/test/event_generator.h" | 18 #include "ui/aura/test/event_generator.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/aura/window_tree_host.h" | 20 #include "ui/aura/window_tree_host.h" |
20 #include "ui/base/clipboard/clipboard.h" | 21 #include "ui/base/clipboard/clipboard.h" |
21 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 22 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
22 #include "ui/base/test/ui_controls.h" | 23 #include "ui/base/test/ui_controls.h" |
23 #include "ui/events/event_processor.h" | 24 #include "ui/events/event_processor.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 EXPECT_FALSE(omnibox_view->IsSelectAll()); | 227 EXPECT_FALSE(omnibox_view->IsSelectAll()); |
227 | 228 |
228 // Pressing tab to focus the omnibox should select all text. | 229 // Pressing tab to focus the omnibox should select all text. |
229 while (!ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)) { | 230 while (!ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)) { |
230 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, | 231 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, |
231 false, false, false, false)); | 232 false, false, false, false)); |
232 } | 233 } |
233 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 234 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
234 EXPECT_TRUE(omnibox_view->IsSelectAll()); | 235 EXPECT_TRUE(omnibox_view->IsSelectAll()); |
235 } | 236 } |
| 237 |
| 238 IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackgroundIsOpaque) { |
| 239 // The omnibox text should be rendered on an opaque background. Otherwise, we |
| 240 // can't use subpixel rendering. |
| 241 BrowserWindowTesting* window = browser()->window()->GetBrowserWindowTesting(); |
| 242 ASSERT_TRUE(window); |
| 243 OmniboxViewViews* view = window->GetLocationBarView()->omnibox_view(); |
| 244 ASSERT_TRUE(view); |
| 245 EXPECT_FALSE(view->GetRenderText()->background_is_transparent()); |
| 246 } |
OLD | NEW |