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

Side by Side Diff: chrome/browser/browser_focus_uitest.cc

Issue 259010: For some reason, if the interactive test that I added runs after inprocess te... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/blocked_popup_container_interactive_uitest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/keyboard_codes.h"
6 #include "base/message_loop.h" 5 #include "base/message_loop.h"
7 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
8 #include "chrome/browser/automation/ui_controls.h" 7 #include "chrome/browser/automation/ui_controls.h"
9 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_window.h" 9 #include "chrome/browser/browser_window.h"
11 #include "chrome/browser/renderer_host/render_view_host.h" 10 #include "chrome/browser/renderer_host/render_view_host.h"
12 #include "chrome/browser/renderer_host/render_widget_host_view.h" 11 #include "chrome/browser/renderer_host/render_widget_host_view.h"
13 #include "chrome/browser/tab_contents/interstitial_page.h" 12 #include "chrome/browser/tab_contents/interstitial_page.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 13 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/browser/tab_contents/tab_contents_view.h" 14 #include "chrome/browser/tab_contents/tab_contents_view.h"
16 #include "chrome/browser/view_ids.h" 15 #include "chrome/browser/view_ids.h"
17 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
18 #include "chrome/test/automation/browser_proxy.h"
19 #include "chrome/test/automation/tab_proxy.h"
20 #include "chrome/test/automation/window_proxy.h"
21 #include "chrome/test/in_process_browser_test.h" 17 #include "chrome/test/in_process_browser_test.h"
22 #include "chrome/test/ui/ui_test.h"
23 #include "chrome/test/ui_test_utils.h" 18 #include "chrome/test/ui_test_utils.h"
24 #include "views/event.h"
25 #include "views/focus/focus_manager.h" 19 #include "views/focus/focus_manager.h"
26 #include "views/view.h" 20 #include "views/view.h"
27 #include "views/window/window.h" 21 #include "views/window/window.h"
28 22
29 #if defined(TOOLKIT_VIEWS) 23 #if defined(TOOLKIT_VIEWS)
30 #include "chrome/browser/views/frame/browser_view.h" 24 #include "chrome/browser/views/frame/browser_view.h"
31 #include "chrome/browser/views/location_bar_view.h" 25 #include "chrome/browser/views/location_bar_view.h"
32 #include "chrome/browser/views/tab_contents/tab_contents_container.h" 26 #include "chrome/browser/views/tab_contents/tab_contents_container.h"
33 #endif 27 #endif
34 28
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 729
736 // Open a regular page, crash, reload. 730 // Open a regular page, crash, reload.
737 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 731 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage));
738 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); 732 ui_test_utils::CrashTab(browser()->GetSelectedTabContents());
739 browser()->Reload(); 733 browser()->Reload();
740 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 734 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
741 // Focus should now be on the tab contents. 735 // Focus should now be on the tab contents.
742 browser()->ShowDownloadsTab(); 736 browser()->ShowDownloadsTab();
743 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 737 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
744 } 738 }
745
746 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId
747 // Tests that tab related keyboard accelerators are reserved by the app.
748
749 class BrowserInteractiveTest : public UITest {
750 };
751
752 TEST_F(BrowserInteractiveTest, ReserveKeyboardAccelerators) {
753 const std::string kBadPage =
754 "<html><script>"
755 "document.onkeydown = function() {"
756 " event.preventDefault();"
757 " return false;"
758 "}"
759 "</script></html>";
760 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
761 browser->AppendTab(GURL("data:text/html," + kBadPage));
762 int tab_count = 0;
763 ASSERT_TRUE(browser->GetTabCount(&tab_count));
764 ASSERT_EQ(tab_count, 2);
765
766 int active_tab = 0;
767 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab));
768 ASSERT_EQ(active_tab, 1);
769
770 scoped_refptr<WindowProxy> window(browser->GetWindow());
771 ASSERT_TRUE(window->SimulateOSKeyPress(
772 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN));
773 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms()));
774
775 ASSERT_TRUE(window->SimulateOSKeyPress(
776 base::VKEY_F4, views::Event::EF_CONTROL_DOWN));
777 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms()));
778 }
779 #endif
OLDNEW
« no previous file with comments | « chrome/browser/blocked_popup_container_interactive_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698