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

Side by Side Diff: components/printing/test/print_web_view_helper_browsertest.cc

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "components/printing/common/print_messages.h" 7 #include "components/printing/common/print_messages.h"
8 #include "components/printing/renderer/print_web_view_helper.h" 8 #include "components/printing/renderer/print_web_view_helper.h"
9 #include "components/printing/test/mock_printer.h" 9 #include "components/printing/test/mock_printer.h"
10 #include "components/printing/test/print_mock_render_thread.h" 10 #include "components/printing/test/print_mock_render_thread.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void TearDown() override { 146 void TearDown() override {
147 #if defined(LEAK_SANITIZER) 147 #if defined(LEAK_SANITIZER)
148 // Do this before shutting down V8 in RenderViewTest::TearDown(). 148 // Do this before shutting down V8 in RenderViewTest::TearDown().
149 // http://crbug.com/328552 149 // http://crbug.com/328552
150 __lsan_do_leak_check(); 150 __lsan_do_leak_check();
151 #endif 151 #endif
152 content::RenderViewTest::TearDown(); 152 content::RenderViewTest::TearDown();
153 } 153 }
154 154
155 void PrintWithJavaScript() { 155 void PrintWithJavaScript() {
156 ExecuteJavaScript("window.print();"); 156 ExecuteJavaScriptForTests("window.print();");
157 ProcessPendingMessages(); 157 ProcessPendingMessages();
158 } 158 }
159 // The renderer should be done calculating the number of rendered pages 159 // The renderer should be done calculating the number of rendered pages
160 // according to the specified settings defined in the mock render thread. 160 // according to the specified settings defined in the mock render thread.
161 // Verify the page count is correct. 161 // Verify the page count is correct.
162 void VerifyPageCount(int count) { 162 void VerifyPageCount(int count) {
163 #if defined(OS_CHROMEOS) 163 #if defined(OS_CHROMEOS)
164 // The DidGetPrintedPagesCount message isn't sent on ChromeOS. Right now we 164 // The DidGetPrintedPagesCount message isn't sent on ChromeOS. Right now we
165 // always print all pages, and there are checks to that effect built into 165 // always print all pages, and there are checks to that effect built into
166 // the print code. 166 // the print code.
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 CreatePrintSettingsDictionary(&dict); 1029 CreatePrintSettingsDictionary(&dict);
1030 OnPrintForPrintPreview(dict); 1030 OnPrintForPrintPreview(dict);
1031 1031
1032 VerifyPrintFailed(true); 1032 VerifyPrintFailed(true);
1033 VerifyPagesPrinted(false); 1033 VerifyPagesPrinted(false);
1034 } 1034 }
1035 1035
1036 #endif // !defined(OS_CHROMEOS) 1036 #endif // !defined(OS_CHROMEOS)
1037 1037
1038 } // namespace printing 1038 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698