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

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

Issue 823703002: Check that dataReductionUpdateDailyLengths is reset. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « chrome/test/data/extensions/api_test/preference/data_reduction_proxy/manifest.json ('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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 // Content settings API test 5 // Content settings API test
6 // Run with browser_tests --gtest_filter=ExtensionApiTest.DataReductionProxy 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.DataReductionProxy
7 7
8 var drp = chrome.dataReductionProxy; 8 var drp = chrome.dataReductionProxy;
9 var pp = chrome.preferencesPrivate;
bengr 2014/12/22 21:57:21 I'd prefer that these variables be spelled out: da
Not at Google. Contact bengr 2014/12/22 22:15:17 Done.
9 chrome.test.runTests([ 10 chrome.test.runTests([
10 function getDrpPrefs() { 11 function getDrpPrefs() {
11 drp.spdyProxyEnabled.get({}, chrome.test.callbackPass( 12 drp.spdyProxyEnabled.get({}, chrome.test.callbackPass(
12 function(result) { 13 function(result) {
13 chrome.test.assertEq( 14 chrome.test.assertEq(
14 { 15 {
15 'value': false, 16 'value': false,
16 'levelOfControl': 'controllable_by_this_extension' 17 'levelOfControl': 'controllable_by_this_extension'
17 }, 18 },
18 result); 19 result);
19 })); 20 }));
20 drp.dataReductionDailyContentLength.get({}, chrome.test.callbackPass( 21 drp.dataReductionDailyContentLength.get({}, chrome.test.callbackPass(
21 function(result) { 22 function(result) {
22 chrome.test.assertEq( 23 chrome.test.assertEq(
23 { 24 {
24 'value': [], 25 'value': [],
25 'levelOfControl': 'controllable_by_this_extension' 26 'levelOfControl': 'controllable_by_this_extension'
26 }, 27 },
27 result); 28 result);
28 })); 29 }));
29 drp.dataReductionDailyReceivedLength.get({}, chrome.test.callbackPass( 30 drp.dataReductionDailyReceivedLength.get({}, chrome.test.callbackPass(
30 function(result) { 31 function(result) {
31 chrome.test.assertEq( 32 chrome.test.assertEq(
32 { 33 {
33 'value': [], 34 'value': [],
34 'levelOfControl': 'controllable_by_this_extension' 35 'levelOfControl': 'controllable_by_this_extension'
35 }, 36 },
36 result); 37 result);
37 })); 38 }));
38 drp.dataReductionUpdateDailyLengths.get({}, chrome.test.callbackPass( 39 pp.dataReductionUpdateDailyLengths.get({}, chrome.test.callbackPass(
39 function(result) { 40 function(result) {
40 chrome.test.assertEq( 41 chrome.test.assertEq(
41 { 42 {
42 'value': false, 43 'value': false
43 'levelOfControl': 'controllable_by_this_extension'
44 }, 44 },
45 result); 45 result);
46 })); 46 }));
47 }, 47 },
48 function updateDailyLengths() { 48 function updateDailyLengths() {
49 drp.dataReductionDailyContentLength.onChange.addListener( 49 drp.dataReductionDailyContentLength.onChange.addListener(
50 confirmDailyContentLength); 50 confirmDailyContentLength);
51 drp.dataReductionDailyReceivedLength.onChange.addListener( 51 drp.dataReductionDailyReceivedLength.onChange.addListener(
52 confirmRecievedLength); 52 confirmRecievedLength);
53 53
54 // Trigger calls to confirmDailyContentLength.onChange and 54 // Trigger calls to confirmDailyContentLength.onChange and
55 // dataReductionDailyReceivedLength.onChange listeners. 55 // dataReductionDailyReceivedLength.onChange listeners.
56 drp.spdyProxyEnabled.set({ 'value': true }); 56 drp.spdyProxyEnabled.set({ 'value': true });
57 drp.dataReductionUpdateDailyLengths.set({'value': true}); 57 pp.dataReductionUpdateDailyLengths.set({'value': true});
58 58
59 // Helper methods. 59 // Helper methods.
60 var expectedDailyLengths = []; 60 var expectedDailyLengths = [];
61 for (var i = 0; i < 60; i++) { 61 for (var i = 0; i < 60; i++) {
62 expectedDailyLengths[i] = '0'; 62 expectedDailyLengths[i] = '0';
63 } 63 }
64 function confirmRecievedLength() { 64 function confirmRecievedLength() {
65 drp.dataReductionDailyReceivedLength.get({}, 65 drp.dataReductionDailyReceivedLength.get({},
66 chrome.test.callbackPass(function(result) { 66 chrome.test.callbackPass(function(result) {
67 chrome.test.assertEq( 67 chrome.test.assertEq(
68 { 68 {
69 'value': expectedDailyLengths , 69 'value': expectedDailyLengths ,
70 'levelOfControl': 'controllable_by_this_extension' 70 'levelOfControl': 'controllable_by_this_extension'
71 }, 71 },
72 result); 72 result);
73 })); 73 }));
74 pp.dataReductionUpdateDailyLengths.get({},
75 chrome.test.callbackPass(function(result) {
76 chrome.test.assertEq(
77 {
78 'value': false
79 },
80 result);
81 }));
74 } 82 }
75 function confirmDailyContentLength() { 83 function confirmDailyContentLength() {
76 drp.dataReductionDailyContentLength.get({}, 84 drp.dataReductionDailyContentLength.get({},
77 chrome.test.callbackPass(function(result) { 85 chrome.test.callbackPass(function(result) {
78 chrome.test.assertEq( 86 chrome.test.assertEq(
79 { 87 {
80 'value': expectedDailyLengths , 88 'value': expectedDailyLengths ,
81 'levelOfControl': 'controllable_by_this_extension' 89 'levelOfControl': 'controllable_by_this_extension'
82 }, 90 },
83 result); 91 result);
84 })); 92 }));
93 pp.dataReductionUpdateDailyLengths.get({},
94 chrome.test.callbackPass(function(result) {
95 chrome.test.assertEq(
96 {
97 'value': false
98 },
99 result);
100 }));
85 } 101 }
86 } 102 }
87 ]); 103 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/preference/data_reduction_proxy/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698