OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/tab_render_watcher.h" | 6 #include "chrome/browser/tab_render_watcher.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 main_frame_rendered_ = true; | 50 main_frame_rendered_ = true; |
51 MessageLoop::current()->Quit(); | 51 MessageLoop::current()->Quit(); |
52 } | 52 } |
53 | 53 |
54 protected: | 54 protected: |
55 bool host_created_; | 55 bool host_created_; |
56 bool main_frame_loaded_; | 56 bool main_frame_loaded_; |
57 bool main_frame_rendered_; | 57 bool main_frame_rendered_; |
58 }; | 58 }; |
59 | 59 |
60 // Migrated from HtmlDialogBrowserTest.TestStateTransition, which times out | 60 // Migrated from WebDialogBrowserTest.TestStateTransition, which times out |
61 // about 5~10% of runs. See crbug.com/86059. | 61 // about 5~10% of runs. See crbug.com/86059. |
62 IN_PROC_BROWSER_TEST_F(TabRenderWatcherTest, DISABLED_TestStateTransition) { | 62 IN_PROC_BROWSER_TEST_F(TabRenderWatcherTest, DISABLED_TestStateTransition) { |
63 views::WebView* webview = new views::WebView(browser()->profile()); | 63 views::WebView* webview = new views::WebView(browser()->profile()); |
64 CreateWindowForContents(webview); | 64 CreateWindowForContents(webview); |
65 webview->GetWidget()->Show(); | 65 webview->GetWidget()->Show(); |
66 | 66 |
67 scoped_ptr<TabRenderWatcher> watcher( | 67 scoped_ptr<TabRenderWatcher> watcher( |
68 new TabRenderWatcher(webview->GetWebContents(), this)); | 68 new TabRenderWatcher(webview->GetWebContents(), this)); |
69 | 69 |
70 EXPECT_FALSE(host_created_); | 70 EXPECT_FALSE(host_created_); |
71 EXPECT_FALSE(main_frame_loaded_); | 71 EXPECT_FALSE(main_frame_loaded_); |
72 EXPECT_FALSE(main_frame_rendered_); | 72 EXPECT_FALSE(main_frame_rendered_); |
73 | 73 |
74 webview->LoadInitialURL(GURL(chrome::kChromeUIChromeURLsURL)); | 74 webview->LoadInitialURL(GURL(chrome::kChromeUIChromeURLsURL)); |
75 EXPECT_TRUE(host_created_); | 75 EXPECT_TRUE(host_created_); |
76 | 76 |
77 // OnTabMainFrameLoaded() will Quit(). | 77 // OnTabMainFrameLoaded() will Quit(). |
78 MessageLoopForUI::current()->Run(); | 78 MessageLoopForUI::current()->Run(); |
79 EXPECT_TRUE(main_frame_loaded_); | 79 EXPECT_TRUE(main_frame_loaded_); |
80 | 80 |
81 // OnTabMainFrameRender() will Quit(). | 81 // OnTabMainFrameRender() will Quit(). |
82 MessageLoopForUI::current()->Run(); | 82 MessageLoopForUI::current()->Run(); |
83 EXPECT_TRUE(main_frame_rendered_); | 83 EXPECT_TRUE(main_frame_rendered_); |
84 | 84 |
85 webview->GetWidget()->Close(); | 85 webview->GetWidget()->Close(); |
86 } | 86 } |
OLD | NEW |