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

Side by Side Diff: chrome/browser/ui/webui/javascript2webui.js

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, 4 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 if (arguments.length < 3) { 4 if (arguments.length < 3) {
5 print('usage: ' + 5 print('usage: ' +
6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]'); 6 arguments[0] + ' path-to-testfile.js testfile.js [output.cc]');
7 quit(-1); 7 quit(-1);
8 } 8 }
9 var jsFile = arguments[1]; 9 var jsFile = arguments[1];
10 var jsFileBase = arguments[2]; 10 var jsFileBase = arguments[2];
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 var typedeffedCppFixtures = {}; 27 var typedeffedCppFixtures = {};
28 28
29 function TEST_F(testFixture, testFunction, testBody) { 29 function TEST_F(testFixture, testFunction, testBody) {
30 var browsePreload = this[testFixture].prototype.browsePreload; 30 var browsePreload = this[testFixture].prototype.browsePreload;
31 var browsePrintPreload = this[testFixture].prototype.browsePrintPreload; 31 var browsePrintPreload = this[testFixture].prototype.browsePrintPreload;
32 var testGenPreamble = this[testFixture].prototype.testGenPreamble; 32 var testGenPreamble = this[testFixture].prototype.testGenPreamble;
33 var testGenPostamble = this[testFixture].prototype.testGenPostamble; 33 var testGenPostamble = this[testFixture].prototype.testGenPostamble;
34 var typedefCppFixture = this[testFixture].prototype.typedefCppFixture; 34 var typedefCppFixture = this[testFixture].prototype.typedefCppFixture;
35 var doPrint = this[testFixture].prototype.print;
35 var isAsync = this[testFixture].prototype.isAsync; 36 var isAsync = this[testFixture].prototype.isAsync;
36 37
37 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) { 38 if (typedefCppFixture && !(testFixture in typedeffedCppFixtures)) {
38 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';'); 39 print('typedef ' + typedefCppFixture + ' ' + testFixture + ';');
39 typedeffedCppFixtures[testFixture] = typedefCppFixture; 40 typedeffedCppFixtures[testFixture] = typedefCppFixture;
40 } 41 }
41 42
42 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {'); 43 print('IN_PROC_BROWSER_TEST_F(' + testFixture + ', ' + testFunction + ') {');
43 if (testGenPreamble) 44 if (testGenPreamble)
44 testGenPreamble(testFixture, testFunction); 45 testGenPreamble(testFixture, testFunction);
45 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));'); 46 print(' AddLibrary(FilePath(FILE_PATH_LITERAL("' + jsFileBase + '")));');
46 if (browsePreload) { 47 if (browsePreload) {
47 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture + 48 print(' BrowsePreload(GURL("' + browsePreload + '"), "' + testFixture +
48 '", "' + testFunction + '");'); 49 '", "' + testFunction + '");');
49 } 50 }
50 if (browsePrintPreload) { 51 if (browsePrintPreload) {
51 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' + 52 print(' BrowsePrintPreload(GURL(WebUITestDataPathToURL(\n' +
52 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' + 53 ' FILE_PATH_LITERAL("' + browsePrintPreload + '"))),\n' +
53 ' "' + testFixture + '", "' + testFunction + '");'); 54 ' "' + testFixture + '", "' + testFunction + '",\n' +
55 ' ' + doPrint + ');');
54 } 56 }
55 print(' ASSERT_TRUE(RunJavascriptTestF(' + isAsync + ', ' + 57 print(' ASSERT_TRUE(RunJavascriptTestF(' + isAsync + ', ' +
56 '"' + testFixture + '", ' + 58 '"' + testFixture + '", ' +
57 '"' + testFunction + '"));'); 59 '"' + testFunction + '"));');
58 if (testGenPostamble) 60 if (testGenPostamble)
59 testGenPostamble(testFixture, testFunction); 61 testGenPostamble(testFixture, testFunction);
60 print('}'); 62 print('}');
61 print(); 63 print();
62 } 64 }
63 65
64 var js = read(jsFile); 66 var js = read(jsFile);
65 eval(js); 67 eval(js);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698