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 8ec8681a52b78b7e4ca787da8c916d7b8d07d1d7..4483c4e0b0b495937554a9b176f662eb5274b8c9 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); |
} |
virtual void GetWebUIMessageHandlers( |
std::vector<WebUIMessageHandler*>* handlers) const { } |
@@ -205,3 +205,30 @@ 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->GetDialogRootWindow(), |
+ gfx::Rect(), html_view); |
+ // Test if the state transitions from INITIALIZED to -> PAINTED |
+ 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::PAINTED) |
+ MessageLoop::current()->RunAllPending(); |
+ |
+ EXPECT_EQ(HtmlDialogView::PAINTED, html_view->state_); |
+ |
+ MessageLoopForUI::current()->RemoveObserver( |
+ WindowChangedObserver::GetInstance()); |
+} |