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

Side by Side Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 8586009: Allow WebUI Tests to use preLoad in HtmlDialogUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert to patch set 4. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/webui/web_ui_browsertest.h" 4 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
5 5
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 RenderViewHost* preload_host) { 168 RenderViewHost* preload_host) {
169 ASSERT_FALSE(libraries_preloaded_); 169 ASSERT_FALSE(libraries_preloaded_);
170 ConstValueVector args; 170 ConstValueVector args;
171 args.push_back(Value::CreateStringValue(preload_test_fixture)); 171 args.push_back(Value::CreateStringValue(preload_test_fixture));
172 args.push_back(Value::CreateStringValue(preload_test_name)); 172 args.push_back(Value::CreateStringValue(preload_test_name));
173 RunJavascriptUsingHandler( 173 RunJavascriptUsingHandler(
174 "preloadJavascriptLibraries", args, false, false, preload_host); 174 "preloadJavascriptLibraries", args, false, false, preload_host);
175 libraries_preloaded_ = true; 175 libraries_preloaded_ = true;
176 } 176 }
177 177
178 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to, 178 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) {
179 const std::string& preload_test_fixture,
180 const std::string& preload_test_name) {
181 // Remember for callback OnJsInjectionReady().
182 preload_test_fixture_ = preload_test_fixture;
183 preload_test_name_ = preload_test_name;
184
185 TestNavigationObserver navigation_observer( 179 TestNavigationObserver navigation_observer(
186 content::Source<NavigationController>( 180 content::Source<NavigationController>(
187 &browser()->GetSelectedTabContentsWrapper()->controller()), 181 &browser()->GetSelectedTabContentsWrapper()->controller()),
188 this, 1); 182 this, 1);
189 browser::NavigateParams params( 183 browser::NavigateParams params(
190 browser(), GURL(browse_to), content::PAGE_TRANSITION_TYPED); 184 browser(), GURL(browse_to), content::PAGE_TRANSITION_TYPED);
191 params.disposition = CURRENT_TAB; 185 params.disposition = CURRENT_TAB;
192 browser::Navigate(&params); 186 browser::Navigate(&params);
193 navigation_observer.WaitForObservation(); 187 navigation_observer.WaitForObservation();
194 } 188 }
195 189
196 void WebUIBrowserTest::BrowsePrintPreload( 190 void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) {
197 const GURL& browse_to,
198 const std::string& preload_test_fixture,
199 const std::string& preload_test_name) {
200 // Remember for callback OnJsInjectionReady().
201 preload_test_fixture_ = preload_test_fixture;
202 preload_test_name_ = preload_test_name;
203
204 ui_test_utils::NavigateToURL(browser(), browse_to); 191 ui_test_utils::NavigateToURL(browser(), browse_to);
205 192
206 TestTabStripModelObserver tabstrip_observer( 193 TestTabStripModelObserver tabstrip_observer(
207 browser()->tabstrip_model(), this); 194 browser()->tabstrip_model(), this);
208 browser()->Print(); 195 browser()->Print();
209 tabstrip_observer.WaitForObservation(); 196 tabstrip_observer.WaitForObservation();
210 printing::PrintPreviewTabController* tab_controller = 197 printing::PrintPreviewTabController* tab_controller =
211 printing::PrintPreviewTabController::GetInstance(); 198 printing::PrintPreviewTabController::GetInstance();
212 ASSERT_TRUE(tab_controller); 199 ASSERT_TRUE(tab_controller);
213 TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab( 200 TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab(
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 // testDone directly and expect pass result. 615 // testDone directly and expect pass result.
629 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { 616 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) {
630 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); 617 ASSERT_TRUE(RunJavascriptAsyncTest("testDone"));
631 } 618 }
632 619
633 // Test that calling testDone during RunJavascriptTest still completes when 620 // Test that calling testDone during RunJavascriptTest still completes when
634 // waiting for async result. 621 // waiting for async result.
635 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { 622 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) {
636 ASSERT_TRUE(RunJavascriptTest("testDone")); 623 ASSERT_TRUE(RunJavascriptTest("testDone"));
637 } 624 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698