summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/compact_location_bar_host_browsertest.cc17
-rw-r--r--chrome/browser/chromeos/compact_navigation_bar_browsertest.cc6
-rw-r--r--chrome/browser/chromeos/login/network_screen_browsertest.cc7
-rw-r--r--chrome/browser/chromeos/notifications/notification_browsertest.cc30
-rw-r--r--chrome/test/in_process_browser_test.cc6
-rw-r--r--chrome/test/in_process_browser_test.h3
-rw-r--r--chrome/test/ui_test_utils.cc5
7 files changed, 36 insertions, 38 deletions
diff --git a/chrome/browser/chromeos/compact_location_bar_host_browsertest.cc b/chrome/browser/chromeos/compact_location_bar_host_browsertest.cc
index 3b4aab5..780e59b 100644
--- a/chrome/browser/chromeos/compact_location_bar_host_browsertest.cc
+++ b/chrome/browser/chromeos/compact_location_bar_host_browsertest.cc
@@ -53,24 +53,24 @@ class CompactLocationBarHostTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestCtrlLOpen) {
// ctrl-l should not open compact location bar in normal mode.
ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(-1));
EXPECT_FALSE(clb_host()->IsVisible());
browser()->ToggleCompactNavigationBar();
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(-1));
EXPECT_FALSE(clb_host()->IsVisible());
// ctrl-l should not open compact location bar in compact nav mode.
ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(0));
EXPECT_TRUE(clb_host()->IsVisible());
// Esc to close it.
ui_controls::SendKeyPress(window(), base::VKEY_ESCAPE, false, false, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(0));
EXPECT_FALSE(clb_host()->IsVisible());
}
@@ -78,19 +78,20 @@ IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestCtrlLOpen) {
IN_PROC_BROWSER_TEST_F(CompactLocationBarHostTest, TestOnNewTab) {
browser()->ToggleCompactNavigationBar();
ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(0));
EXPECT_TRUE(clb_host()->IsVisible());
browser()->NewTab();
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
+
+ // See http://crbug.com/39858 for details.
//EXPECT_FALSE(clb_host()->IsVisible());
ui_controls::SendKeyPress(window(), base::VKEY_L, true, false, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsCurrentTabIndex(1));
EXPECT_TRUE(clb_host()->IsVisible());
}
} // namespace chromeos
-
diff --git a/chrome/browser/chromeos/compact_navigation_bar_browsertest.cc b/chrome/browser/chromeos/compact_navigation_bar_browsertest.cc
index de4e9b4..c773972 100644
--- a/chrome/browser/chromeos/compact_navigation_bar_browsertest.cc
+++ b/chrome/browser/chromeos/compact_navigation_bar_browsertest.cc
@@ -51,16 +51,16 @@ IN_PROC_BROWSER_TEST_F(CompactNavigationBarTest, TestAccelerator) {
// ctrl-shift-c should toggle compact navigation bar.
ui_controls::SendKeyPress(window, base::VKEY_C, true, true, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsViewIdVisible(VIEW_ID_COMPACT_NAV_BAR));
ui_controls::SendKeyPress(window, base::VKEY_C, true, true, false);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsViewIdVisible(VIEW_ID_COMPACT_NAV_BAR));
// but ctrl-alt-c should not.
ui_controls::SendKeyPress(window, base::VKEY_C, true, false, true);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsViewIdVisible(VIEW_ID_COMPACT_NAV_BAR));
}
diff --git a/chrome/browser/chromeos/login/network_screen_browsertest.cc b/chrome/browser/chromeos/login/network_screen_browsertest.cc
index 706245a..c2fc808 100644
--- a/chrome/browser/chromeos/login/network_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/network_screen_browsertest.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h"
#include "chrome/browser/chromeos/login/wizard_screen.h"
+#include "chrome/test/ui_test_utils.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -240,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, EthernetSelected) {
WifiCellularNetworksExpectations();
network_screen->ItemChanged(&combobox, 0, 1);
network_view->SetSelectedNetworkItem(1);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
controller()->set_observer(NULL);
}
@@ -277,7 +278,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, WifiSelected) {
EXPECT_CALL(*mock_network_library_,
ConnectToWifiNetwork(A<WifiNetwork>(), string16()))
.Times(1);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
ASSERT_EQ(2, network_screen->GetItemCount());
// Emulate connecting WiFi network.
@@ -307,7 +308,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, WifiSelected) {
WifiCellularNetworksExpectations();
WifiSsidExpectation(wifi_ssid);
network_screen->NetworkChanged(network_library);
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
controller()->set_observer(NULL);
}
diff --git a/chrome/browser/chromeos/notifications/notification_browsertest.cc b/chrome/browser/chromeos/notifications/notification_browsertest.cc
index 7524f83..9b65e45 100644
--- a/chrome/browser/chromeos/notifications/notification_browsertest.cc
+++ b/chrome/browser/chromeos/notifications/notification_browsertest.cc
@@ -78,14 +78,14 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestBasic) {
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Remove(NewMockNotification("1"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(1, tester->GetNewNotificationCount());
EXPECT_EQ(1, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Remove(NewMockNotification("2"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetNewNotificationCount());
EXPECT_EQ(0, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
@@ -110,13 +110,13 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) {
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state());
collection->Remove(NewMockNotification("1"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(1, tester->GetNewNotificationCount());
EXPECT_EQ(1, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::KEEP_SIZE, tester->state());
collection->Remove(NewMockNotification("2"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
@@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestKeepSizeState) {
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Remove(NewMockNotification("3"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
}
@@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestSystemNotification) {
// or Remove(std::string id);
collection->Remove(Notification(GURL(), GURL(),
std::wstring(), delegate.get()));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetStickyNotificationCount());
EXPECT_EQ(0, tester->GetNewNotificationCount());
@@ -176,15 +176,15 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition1) {
collection->Add(NewMockNotification("2"), browser()->profile());
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::MINIMIZED, tester->state());
collection->Remove(NewMockNotification("2"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::MINIMIZED, tester->state());
collection->Remove(NewMockNotification("1"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
}
@@ -205,13 +205,13 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) {
collection->Add(NewMockNotification("1"), browser()->profile());
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::MINIMIZED, tester->state());
collection->Add(NewMockNotification("2"), browser()->profile());
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::MINIMIZED, tester->state());
collection->AddSystemNotification(
@@ -219,20 +219,20 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) {
EXPECT_EQ(3, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Remove(NewMockNotification("1"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(NotificationPanel::STICKY_AND_NEW, tester->state());
collection->Remove(NewMockNotification("3"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(1, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::MINIMIZED, tester->state());
collection->Remove(NewMockNotification("2"));
- RunAllPendingEvents();
+ ui_test_utils::RunAllPendingInMessageLoop();
EXPECT_EQ(0, tester->GetNotificationCount());
EXPECT_EQ(NotificationPanel::CLOSED, tester->state());
}
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 6070bd4..78ba891 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -320,9 +320,3 @@ void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) {
DCHECK_GT(timeout_value, 0);
initial_timeout_ = timeout_value;
}
-
-void InProcessBrowserTest::RunAllPendingEvents() {
- MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
- ui_test_utils::RunMessageLoop();
-}
-
diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h
index dfcf6d6..6e922d9 100644
--- a/chrome/test/in_process_browser_test.h
+++ b/chrome/test/in_process_browser_test.h
@@ -114,9 +114,6 @@ class InProcessBrowserTest : public testing::Test {
void EnableDOMAutomation() { dom_automation_enabled_ = true; }
void EnableSingleProcess() { single_process_ = true; }
- // Run all pending events in the message loop.
- void RunAllPendingEvents();
-
private:
// Invokes CreateBrowser to create a browser, then RunTestOnMainThread, and
// destroys the browser.
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 96d04b6..b334e05 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -395,6 +395,11 @@ void RunMessageLoop() {
loop->SetNestableTasksAllowed(did_allow_task_nesting);
}
+void RunAllPendingInMessageLoop() {
+ MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
+ ui_test_utils::RunMessageLoop();
+}
+
bool GetCurrentTabTitle(const Browser* browser, string16* title) {
TabContents* tab_contents = browser->GetSelectedTabContents();
if (!tab_contents)