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

Side by Side Diff: chrome/test/data/extensions/api_test/save_page/test.js

Issue 8631017: Change the first parameter of savePage.saveAsMHTML to be a dictionary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied Antony's suggestions 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
« no previous file with comments | « chrome/common/extensions/docs/static/experimental.savePage.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 // API test for chrome.extension.savePage. 5 // API test for chrome.extension.savePage.
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.SavePage 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.SavePage
7 7
8 const assertEq = chrome.test.assertEq; 8 const assertEq = chrome.test.assertEq;
9 const assertTrue = chrome.test.assertTrue; 9 const assertTrue = chrome.test.assertTrue;
10 10
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 chrome.test.getConfig(function(config) { 24 chrome.test.getConfig(function(config) {
25 testUrl = testUrl.replace(/PORT/, config.testServer.port); 25 testUrl = testUrl.replace(/PORT/, config.testServer.port);
26 26
27 chrome.test.runTests([ 27 chrome.test.runTests([
28 function savePageAsMHTML() { 28 function savePageAsMHTML() {
29 chrome.tabs.getSelected(null, function(tab) { 29 chrome.tabs.getSelected(null, function(tab) {
30 chrome.tabs.update(null, { "url": testUrl }); 30 chrome.tabs.update(null, { "url": testUrl });
31 waitForCurrentTabLoaded(function() { 31 waitForCurrentTabLoaded(function() {
32 chrome.experimental.savePage.saveAsMHTML(tab.id, function(data) { 32 chrome.experimental.savePage.saveAsMHTML({ "tabId": tab.id },
33 function(data) {
33 assertEq(undefined, chrome.extension.lastError); 34 assertEq(undefined, chrome.extension.lastError);
34 assertTrue(data != null); 35 assertTrue(data != null);
35 // It should contain few KBs of data. 36 // It should contain few KBs of data.
36 assertTrue(data.size > 100); 37 assertTrue(data.size > 100);
37 // Let's make sure it contains some well known strings. 38 // Let's make sure it contains some well known strings.
38 var reader = new FileReader(); 39 var reader = new FileReader();
39 reader.onload = function(e) { 40 reader.onload = function(e) {
40 var text = e.target.result; 41 var text = e.target.result;
41 assertTrue(text.indexOf(testUrl) != -1); 42 assertTrue(text.indexOf(testUrl) != -1);
42 assertTrue(text.indexOf("logo.png") != -1); 43 assertTrue(text.indexOf("logo.png") != -1);
43 chrome.test.notifyPass(); 44 chrome.test.notifyPass();
44 }; 45 };
45 reader.readAsText(data); 46 reader.readAsText(data);
46 }); 47 });
47 }); 48 });
48 }); 49 });
49 } 50 }
50 ]); 51 ]);
51 }); 52 });
52 53
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/static/experimental.savePage.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698