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

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

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Lei's comments. Created 9 years, 3 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 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/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 browser::NavigateParams params( 183 browser::NavigateParams params(
184 browser(), GURL(browse_to), PageTransition::TYPED); 184 browser(), GURL(browse_to), PageTransition::TYPED);
185 params.disposition = CURRENT_TAB; 185 params.disposition = CURRENT_TAB;
186 browser::Navigate(&params); 186 browser::Navigate(&params);
187 navigation_observer.WaitForObservation(); 187 navigation_observer.WaitForObservation();
188 } 188 }
189 189
190 void WebUIBrowserTest::BrowsePrintPreload( 190 void WebUIBrowserTest::BrowsePrintPreload(
191 const GURL& browse_to, 191 const GURL& browse_to,
192 const std::string& preload_test_fixture, 192 const std::string& preload_test_fixture,
193 const std::string& preload_test_name) { 193 const std::string& preload_test_name,
194 bool print) {
194 // Remember for callback OnJsInjectionReady(). 195 // Remember for callback OnJsInjectionReady().
195 preload_test_fixture_ = preload_test_fixture; 196 preload_test_fixture_ = preload_test_fixture;
196 preload_test_name_ = preload_test_name; 197 preload_test_name_ = preload_test_name;
197 198
199 TestTabStripModelObserver tabstrip_observer(
200 browser()->tabstrip_model(), this);
201
198 ui_test_utils::NavigateToURL(browser(), browse_to); 202 ui_test_utils::NavigateToURL(browser(), browse_to);
199 203
200 TestTabStripModelObserver tabstrip_observer( 204 if (print)
201 browser()->tabstrip_model(), this); 205 browser()->Print();
202 browser()->Print(); 206
203 tabstrip_observer.WaitForObservation(); 207 tabstrip_observer.WaitForObservation();
204 } 208 }
205 209
206 const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL"; 210 const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL";
207 211
208 WebUIBrowserTest::WebUIBrowserTest() 212 WebUIBrowserTest::WebUIBrowserTest()
209 : test_handler_(new WebUITestHandler()), 213 : test_handler_(new WebUITestHandler()),
210 libraries_preloaded_(false) {} 214 libraries_preloaded_(false) {}
211 215
212 namespace { 216 namespace {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // testDone directly and expect pass result. 585 // testDone directly and expect pass result.
582 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { 586 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) {
583 ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); 587 ASSERT_TRUE(RunJavascriptAsyncTest("testDone"));
584 } 588 }
585 589
586 // Test that calling testDone during RunJavascriptTest still completes when 590 // Test that calling testDone during RunJavascriptTest still completes when
587 // waiting for async result. 591 // waiting for async result.
588 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { 592 IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) {
589 ASSERT_TRUE(RunJavascriptTest("testDone")); 593 ASSERT_TRUE(RunJavascriptTest("testDone"));
590 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698