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

Unified Diff: chrome/browser/views/find_bar_win_browsertest.cc

Issue 115832: Fix 12729: Find box doesn't unregister Esc accelerator.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/find_bar_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/find_bar_win_browsertest.cc
===================================================================
--- chrome/browser/views/find_bar_win_browsertest.cc (revision 16885)
+++ chrome/browser/views/find_bar_win_browsertest.cc (working copy)
@@ -13,6 +13,7 @@
#include "chrome/common/notification_service.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
+#include "views/focus/focus_manager.h"
const std::wstring kSimplePage = L"404_is_enough_for_us.html";
const std::wstring kFramePage = L"files/find_in_page/frames.html";
@@ -519,7 +520,7 @@
FindNextInNewTabUsesPrepopulate) {
HTTPTestServer* server = StartHTTPServer();
- // First we navigate to our special focus tracking page.
+ // First we navigate to any page.
GURL url = server->TestServerPageW(kSimplePage);
ui_test_utils::NavigateToURL(browser(), url);
@@ -546,3 +547,37 @@
EXPECT_EQ(0, FindInPage(std::wstring(), FWD, IGNORE_CASE, &ordinal));
EXPECT_EQ(0, ordinal);
}
+
+// Make sure Find box grabs the Esc accelerator and restores it again.
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, AcceleratorRestoring) {
+ HTTPTestServer* server = StartHTTPServer();
+
+ // First we navigate to any page.
+ GURL url = server->TestServerPageW(kSimplePage);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ views::FocusManager* focus_manager = views::FocusManager::GetFocusManager(
+ browser()->window()->GetNativeHandle());
+
+ // See where Escape is registered.
+ views::Accelerator escape(VK_ESCAPE, false, false, false);
+ views::AcceleratorTarget* old_target =
+ focus_manager->GetTargetForAccelerator(escape);
+ EXPECT_TRUE(old_target != NULL);
+
+ // Open the Find box.
+ browser()->ShowFindBar();
+
+ // Our Find bar should be the new target.
+ views::AcceleratorTarget* new_target =
+ focus_manager->GetTargetForAccelerator(escape);
+
+ EXPECT_TRUE(new_target != NULL);
+ EXPECT_NE(new_target, old_target);
+
+ // Close the Find box.
+ browser()->find_bar()->EndFindSession();
+
+ // The accelerator for Escape should be back to what it was before.
+ EXPECT_EQ(old_target, focus_manager->GetTargetForAccelerator(escape));
+}
« no previous file with comments | « chrome/browser/views/find_bar_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698