summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_focus_uitest.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 08:02:42 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-06 08:02:42 +0000
commitf07d7bfb75a35d89075e6b88ace6ccfb76cbe97b (patch)
treed650fed9834d5a7468321ace5cc4502c728a7caa /chrome/browser/browser_focus_uitest.cc
parenta67e851f7913d42e4e550062d23779acec333aab (diff)
downloadchromium_src-f07d7bfb75a35d89075e6b88ace6ccfb76cbe97b.zip
chromium_src-f07d7bfb75a35d89075e6b88ace6ccfb76cbe97b.tar.gz
chromium_src-f07d7bfb75a35d89075e6b88ace6ccfb76cbe97b.tar.bz2
Enable interactive_ui_tests
* changed DCHECK in tree_node_model to make it easy to find how it failed. * Fixed compilation error in find_bar_host_interactive_uitest.cc on linux/views. * Disabled BrowserKeyEventsTest.AccessKeys for Chromeos Added/Changed ui_test_utils::RunAllPendingInMessageLoop where necessary. * Disabled tab_dragging_tests. I included the source so that we can catch compilation error even if tests do not run. Changed the comment from // -> /* as GCC complains the use of "\" (and potentially dangerous) * Added SleepInMessageLoop to allow event loop to execute the tasks/events while waiting. * For RunAllPendingInMessageLoop change, please see http://codereview.chromium.org/1591004 BUG=39736 TEST=interactive_ui_tests should pass with following cls http://codereview.chromium.org/1594003 http://codereview.chromium.org/1545011. Review URL: http://codereview.chromium.org/1576008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_focus_uitest.cc')
-rw-r--r--chrome/browser/browser_focus_uitest.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 47bace1..77008e8 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -4,6 +4,7 @@
#include "build/build_config.h"
+#include "base/format_macros.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "chrome/browser/automation/ui_controls.h"
@@ -401,7 +402,9 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BackgroundBrowserDontStealFocus) {
focused_browser->window()->Activate();
// Wait for the focus to be stolen by the other browser.
- PlatformThread::Sleep(2000);
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, new MessageLoop::QuitTask(), 2000);
+ ui_test_utils::RunMessageLoop();
// Make sure the first browser is still active.
EXPECT_TRUE(focused_browser->window()->IsActive());
@@ -452,11 +455,13 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) {
// Test forward focus traversal.
for (int i = 0; i < 3; ++i) {
+ SCOPED_TRACE(StringPrintf("outer loop: %d", i));
// Location bar should be focused.
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
// Now let's press tab to move the focus.
for (size_t j = 0; j < arraysize(kExpElementIDs); ++j) {
+ SCOPED_TRACE(StringPrintf("inner loop %" PRIuS, j));
// Let's make sure the focus is on the expected element in the page.
std::string actual;
ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
@@ -481,16 +486,18 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) {
// At this point the renderer has sent us a message asking to advance the
// focus (as the end of the focus loop was reached in the renderer).
// We need to run the message loop to process it.
- MessageLoop::current()->RunAllPending();
+ ui_test_utils::RunAllPendingInMessageLoop();
}
// Now let's try reverse focus traversal.
for (int i = 0; i < 3; ++i) {
+ SCOPED_TRACE(StringPrintf("outer loop: %d", i));
// Location bar should be focused.
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
// Now let's press shift-tab to move the focus in reverse.
for (size_t j = 0; j < 7; ++j) {
+ SCOPED_TRACE(StringPrintf("inner loop: %" PRIuS, j));
ASSERT_TRUE(ui_controls::SendKeyPress(window, base::VKEY_TAB,
false, true, false));
@@ -515,7 +522,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) {
// At this point the renderer has sent us a message asking to advance the
// focus (as the end of the focus loop was reached in the renderer).
// We need to run the message loop to process it.
- MessageLoop::current()->RunAllPending();
+ ui_test_utils::RunAllPendingInMessageLoop();
}
}
@@ -577,7 +584,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) {
// At this point the renderer has sent us a message asking to advance the
// focus (as the end of the focus loop was reached in the renderer).
// We need to run the message loop to process it.
- MessageLoop::current()->RunAllPending();
+ ui_test_utils::RunAllPendingInMessageLoop();
}
// Now let's try reverse focus traversal.
@@ -605,7 +612,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) {
// At this point the renderer has sent us a message asking to advance the
// focus (as the end of the focus loop was reached in the renderer).
// We need to run the message loop to process it.
- MessageLoop::current()->RunAllPending();
+ ui_test_utils::RunAllPendingInMessageLoop();
}
}
@@ -702,6 +709,9 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) {
IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) {
// Open the history tab, focus should be on the tab contents.
browser()->ShowHistoryTab();
+
+ ui_test_utils::RunAllPendingInMessageLoop();
+
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
// Open the new tab, focus should be on the location bar.
@@ -724,6 +734,9 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) {
// Open the new tab, reload.
browser()->NewTab();
+
+ ui_test_utils::RunAllPendingInMessageLoop();
+
browser()->Reload();
ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
// Focus should stay on the location bar.