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

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

Issue 10836324: Panels test cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback change to remove redundant if-check Created 8 years, 4 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/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_browsertest.cc
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index 90034716a83bdb8c0e9571a7d3fffe914ad5ac78..7164e04e75c52ff6e5f59d462a65d935d81165b9 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -269,9 +269,9 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_CheckDockedPanelProperties) {
Panel* panel2 = CreatePanelWithBounds("2", gfx::Rect(0, 0, 100, 100));
Panel* panel3 = CreatePanelWithBounds("3", gfx::Rect(0, 0, 100, 100));
panel2->SetExpansionState(Panel::TITLE_ONLY);
- WaitForExpansionStateChanged(panel2, Panel::TITLE_ONLY);
+ EXPECT_EQ(Panel::TITLE_ONLY, panel2->expansion_state());
panel3->SetExpansionState(Panel::MINIMIZED);
- WaitForExpansionStateChanged(panel3, Panel::MINIMIZED);
+ EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
scoped_ptr<NativePanelTesting> panel1_testing(
CreateNativePanelTesting(panel1));
scoped_ptr<NativePanelTesting> panel2_testing(
@@ -367,6 +367,14 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) {
params.url = url;
Panel* panel = CreatePanelWithParams(params);
+ // Ensure panel has auto resized to original web content size.
+ // The resize will update the docked panel strip.
+ content::WindowedNotificationObserver initial_resize(
+ chrome::NOTIFICATION_PANEL_STRIP_UPDATED,
+ content::NotificationService::AllSources());
+ if (panel->GetBounds().height() < panel->TitleOnlyHeight())
+ initial_resize.Wait();
+
// Expand the test page. The resize will update the docked panel strip.
gfx::Rect initial_bounds = panel->GetBounds();
content::WindowedNotificationObserver enlarge(
@@ -746,7 +754,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoreAllWithTitlebarClick) {
panel1->FlashFrame(true);
EXPECT_TRUE(panel1->IsDrawingAttention());
- test_panel2->PressLeftMouseButtonTitlebar(panel3->GetBounds().origin(),
+ test_panel2->PressLeftMouseButtonTitlebar(panel2->GetBounds().origin(),
panel::APPLY_TO_ALL);
test_panel2->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL);
EXPECT_FALSE(panel1->IsMinimized());
@@ -1041,7 +1049,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhileMinimized) {
// Test that the attention is drawn and the title-bar is brought up when the
// minimized panel is drawing attention.
panel->Minimize();
- WaitForExpansionStateChanged(panel, Panel::MINIMIZED);
+ EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state());
panel->FlashFrame(true);
EXPECT_TRUE(panel->IsDrawingAttention());
EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state());
@@ -1251,19 +1259,17 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest,
scoped_ptr<NativePanelTesting> native_panel_testing(
CreateNativePanelTesting(panel));
+ PanelActiveStateObserver signal(panel, false);
panel->Minimize(); // this should deactivate.
- MessageLoop::current()->RunAllPending();
- WaitForPanelActiveState(panel, SHOW_AS_INACTIVE);
+ signal.Wait();
EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state());
panel->Restore();
- MessageLoop::current()->RunAllPending();
- WaitForExpansionStateChanged(panel, Panel::EXPANDED);
+ EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
// Verify that minimizing a panel right after expansion works.
panel->Minimize();
- MessageLoop::current()->RunAllPending();
- WaitForExpansionStateChanged(panel, Panel::MINIMIZED);
+ EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state());
panel->Close();
}
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698