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

Unified Diff: chrome/browser/ui/panels/base_panel_browser_test.cc

Issue 8503037: Fix the problem that notifications and panels overlap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/base_panel_browser_test.cc
diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc
index 037a52f5f4fbfb4281267e882b77d79ff0cebd43..8f5f3a0988df5fab82eb5f943cc7b80228629a99 100644
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc
@@ -147,6 +147,11 @@ void MockAutoHidingDesktopBarImpl::NotifyThicknessChange() {
observer_->OnAutoHidingDesktopBarThicknessChanged();
}
+bool ExistsPanel(Panel* panel) {
+ const PanelManager::Panels& panels = PanelManager::GetInstance()->panels();
+ return find(panels.begin(), panels.end(), panel) != panels.end();
+}
+
} // namespace
BasePanelBrowserTest::BasePanelBrowserTest()
@@ -174,7 +179,10 @@ void BasePanelBrowserTest::SetUpOnMainThread() {
mock_auto_hiding_desktop_bar_ = new MockAutoHidingDesktopBarImpl(
panel_manager);
panel_manager->set_auto_hiding_desktop_bar(mock_auto_hiding_desktop_bar_);
- panel_manager->SetWorkAreaForTesting(testing_work_area_);
+ // Do not use the testing work area if it is empty since we're going to
+ // use the actual work area in some testing scenarios.
+ if (!testing_work_area_.IsEmpty())
+ panel_manager->SetWorkAreaForTesting(testing_work_area_);
panel_manager->enable_auto_sizing(false);
panel_manager->remove_delays_for_testing();
// This is needed so the subsequently created panels can be activated.
@@ -182,6 +190,26 @@ void BasePanelBrowserTest::SetUpOnMainThread() {
EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
}
+void BasePanelBrowserTest::WaitForPanelAdded(Panel* panel) {
+ if (ExistsPanel(panel))
+ return;
+ ui_test_utils::WindowedNotificationObserver signal(
jennb 2011/11/11 23:02:43 Should create the signal first, then do the 'if (E
+ chrome::NOTIFICATION_PANEL_ADDED,
+ content::Source<Panel>(panel));
+ signal.Wait();
+ EXPECT_TRUE(ExistsPanel(panel));
+}
+
+void BasePanelBrowserTest::WaitForPanelRemoved(Panel* panel) {
+ if (!ExistsPanel(panel))
+ return;
+ ui_test_utils::WindowedNotificationObserver signal(
+ chrome::NOTIFICATION_PANEL_REMOVED,
+ content::Source<Panel>(panel));
+ signal.Wait();
+ EXPECT_FALSE(ExistsPanel(panel));
+}
+
void BasePanelBrowserTest::WaitForPanelActiveState(
Panel* panel, ActiveState expected_state) {
DCHECK(expected_state == SHOW_AS_ACTIVE ||

Powered by Google App Engine
This is Rietveld 408576698