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

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

Issue 329853010: Additional methods for chrome.logPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 chrome.test.getConfig(function(config) {
6 runAllTests('http://www.test.com:' + config.testServer.port);
7 });
8
9 function runAllTests(testServerUrl) {
10 chrome.test.runTests([
11 function dumpLogsTest() {
12 chrome.logPrivate.dumpLogs(function(fileEntry) {
13 if (!fileEntry.name.match(/\.tar\.gz$/g)) {
14 chrome.test.fail('Invalid file type: '+ fileEntry.name);
15 return;
16 }
17
18 fileEntry.file(function(file) {
19 var reader = new FileReader();
20 reader.onloadend = function(e) {
21 if (this.result.byteLength > 0)
22 chrome.test.succeed();
23 else
24 chrome.test.fail('Invalid log file content');
25 };
26 reader.readAsArrayBuffer(file);
27 },
28 function() {
29 chrome.test.fail('File reading error');
30 });
31 });
32 },
33 function captureNetworkEvents() {
34 chrome.logPrivate.onCapturedEvents.addListener(function(entries) {
35 for (var i = 0; i < entries.length; i++) {
36 // Find our XHR request from below:
37 if (entries[i].params && entries[i].params.url &&
38 entries[i].params.url.match(/www\.test\.com/g)) {
39 chrome.logPrivate.stopEventRecorder('network', function() {
40 chrome.test.succeed();
41 });
42 }
43 }
44 });
45 chrome.logPrivate.startEventRecorder('network', 'capture', function() {
46 var req = new XMLHttpRequest();
47 req.onreadystatechange = function() {}
48 req.open('GET', testServerUrl, true);
49 req.send();
50 });
51 }
52 ]);
53 }
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/log_private/dump_logs/manifest.json ('k') | chromeos/dbus/debug_daemon_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698