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

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_navigator.h" 11 #include "chrome/browser/ui/browser_navigator.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/find_bar/find_bar.h" 13 #include "chrome/browser/ui/find_bar/find_bar.h"
14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 14 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
15 #include "chrome/browser/ui/find_bar/find_notification_details.h" 15 #include "chrome/browser/ui/find_bar/find_notification_details.h"
16 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 16 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.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/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
22 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
23 #include "content/browser/tab_contents/tab_contents_view.h" 23 #include "content/browser/tab_contents/tab_contents_view.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "net/test/test_server.h" 26 #include "net/test/test_server.h"
27 #include "ui/base/keycodes/keyboard_codes.h" 27 #include "ui/base/keycodes/keyboard_codes.h"
28 #include "ui/base/models/accelerator.h"
28 29
29 #if defined(TOOLKIT_VIEWS) 30 #if defined(TOOLKIT_VIEWS)
30 #include "chrome/browser/ui/views/find_bar_host.h" 31 #include "chrome/browser/ui/views/find_bar_host.h"
31 #include "views/focus/focus_manager.h" 32 #include "views/focus/focus_manager.h"
32 #include "views/widget/widget.h" 33 #include "views/widget/widget.h"
33 #elif defined(TOOLKIT_GTK) 34 #elif defined(TOOLKIT_GTK)
34 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" 35 #include "chrome/browser/ui/gtk/slide_animator_gtk.h"
35 #elif defined(OS_MACOSX) 36 #elif defined(OS_MACOSX)
36 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 37 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
37 #endif 38 #endif
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 757
757 // First we navigate to any page. 758 // First we navigate to any page.
758 GURL url = test_server()->GetURL(kSimplePage); 759 GURL url = test_server()->GetURL(kSimplePage);
759 ui_test_utils::NavigateToURL(browser(), url); 760 ui_test_utils::NavigateToURL(browser(), url);
760 761
761 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); 762 gfx::NativeWindow window = browser()->window()->GetNativeHandle();
762 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); 763 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
763 views::FocusManager* focus_manager = widget->GetFocusManager(); 764 views::FocusManager* focus_manager = widget->GetFocusManager();
764 765
765 // See where Escape is registered. 766 // See where Escape is registered.
766 views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false); 767 ui::Accelerator escape(ui::VKEY_ESCAPE, false, false, false);
767 views::AcceleratorTarget* old_target = 768 ui::AcceleratorTarget* old_target =
768 focus_manager->GetCurrentTargetForAccelerator(escape); 769 focus_manager->GetCurrentTargetForAccelerator(escape);
769 EXPECT_TRUE(old_target != NULL); 770 EXPECT_TRUE(old_target != NULL);
770 771
771 browser()->ShowFindBar(); 772 browser()->ShowFindBar();
772 773
773 // Our Find bar should be the new target. 774 // Our Find bar should be the new target.
774 views::AcceleratorTarget* new_target = 775 ui::AcceleratorTarget* new_target =
775 focus_manager->GetCurrentTargetForAccelerator(escape); 776 focus_manager->GetCurrentTargetForAccelerator(escape);
776 777
777 EXPECT_TRUE(new_target != NULL); 778 EXPECT_TRUE(new_target != NULL);
778 EXPECT_NE(new_target, old_target); 779 EXPECT_NE(new_target, old_target);
779 780
780 // Close the Find box. 781 // Close the Find box.
781 browser()->GetFindBarController()->EndFindSession( 782 browser()->GetFindBarController()->EndFindSession(
782 FindBarController::kKeepSelection); 783 FindBarController::kKeepSelection);
783 784
784 // The accelerator for Escape should be back to what it was before. 785 // The accelerator for Escape should be back to what it was before.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 MessageLoop::current()->RunAllPending(); 1135 MessageLoop::current()->RunAllPending();
1135 1136
1136 EnsureFindBoxOpenForBrowser(popup); 1137 EnsureFindBoxOpenForBrowser(popup);
1137 1138
1138 // GTK adjusts FindBar size asynchronously. 1139 // GTK adjusts FindBar size asynchronously.
1139 MessageLoop::current()->RunAllPending(); 1140 MessageLoop::current()->RunAllPending();
1140 1141
1141 ASSERT_LE(GetFindBarWidthForBrowser(popup), 1142 ASSERT_LE(GetFindBarWidthForBrowser(popup),
1142 popup->window()->GetBounds().width()); 1143 popup->window()->GetBounds().width());
1143 } 1144 }
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/ui/panels/panel_browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698