Index: chrome/browser/ui/views/html_dialog_view_browsertest.cc |
diff --git a/chrome/browser/ui/views/html_dialog_view_browsertest.cc b/chrome/browser/ui/views/html_dialog_view_browsertest.cc |
index 1d351c0f0c6a4b8fb0253750e2b41613e44c2b01..af33ab2ff577f3344f141c913b9cfabdcc295e99 100644 |
--- a/chrome/browser/ui/views/html_dialog_view_browsertest.cc |
+++ b/chrome/browser/ui/views/html_dialog_view_browsertest.cc |
@@ -42,7 +42,7 @@ class TestHtmlDialogUIDelegate : public HtmlDialogUIDelegate { |
return std::wstring(L"Test"); |
} |
virtual GURL GetDialogContentURL() const { |
- return GURL(chrome::kAboutBlankURL); |
+ return GURL(chrome::kAboutAboutURL); |
oshima
2011/06/07 19:10:09
this has to be some real page so that it gets pain
|
} |
virtual void GetWebUIMessageHandlers( |
std::vector<WebUIMessageHandler*>* handlers) const { } |
@@ -205,3 +205,35 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { |
MessageLoopForUI::current()->RemoveObserver( |
WindowChangedObserver::GetInstance()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, TestStateTransition) { |
+ HtmlDialogUIDelegate* delegate = new TestHtmlDialogUIDelegate(); |
+ |
+ HtmlDialogView* html_view = |
+ new HtmlDialogView(browser()->profile(), delegate); |
+ TabContents* tab_contents = browser()->GetSelectedTabContents(); |
+ ASSERT_TRUE(tab_contents != NULL); |
+ views::Window::CreateChromeWindow(tab_contents->GetMessageBoxRootWindow(), |
+ gfx::Rect(), html_view); |
+ // Test if the state transitions INITIALIZED -> LOADED -> PAINTED in this |
+ // order. |
+ EXPECT_EQ(HtmlDialogView::INITIALIZED, html_view->state_); |
+ |
+ html_view->InitDialog(); |
+ html_view->window()->Show(); |
+ |
+ MessageLoopForUI::current()->AddObserver( |
+ WindowChangedObserver::GetInstance()); |
+ // We use busy loop because the state is updated in notifications. |
+ while (html_view->state_ == HtmlDialogView::INITIALIZED) |
+ MessageLoop::current()->RunAllPending(); |
+ EXPECT_EQ(HtmlDialogView::LOADED, html_view->state_); |
+ |
+ while (html_view->state_ == HtmlDialogView::LOADED) |
+ MessageLoop::current()->RunAllPending(); |
+ |
+ EXPECT_EQ(HtmlDialogView::PAINTED, html_view->state_); |
+ |
+ MessageLoopForUI::current()->RemoveObserver( |
+ WindowChangedObserver::GetInstance()); |
+} |