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

Unified Diff: chrome/browser/ui/views/html_dialog_view_browsertest.cc

Issue 7024032: Wait showing html dialog until renderer finish painting after page is loaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 6 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/views/html_dialog_view.cc ('k') | chrome/browser/ui/views/keyboard_overlay_dialog_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+}
« no previous file with comments | « chrome/browser/ui/views/html_dialog_view.cc ('k') | chrome/browser/ui/views/keyboard_overlay_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698