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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/budget/budget-service-mock.js

Issue 2620393002: Refactor budget computation to be more tuneable. (Closed)
Patch Set: Changed LayoutTest to expect integral budgets. (Also rebased) Created 3 years, 11 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 /** 1 /**
2 * Mock implementation of the budget service. 2 * Mock implementation of the budget service.
3 */ 3 */
4 4
5 "use strict"; 5 "use strict";
6 6
7 const TEST_BUDGET_COST = 1.2; 7 const TEST_BUDGET_COST = 1.2;
8 const TEST_BUDGET_AT = 2.3; 8 const TEST_BUDGET_AT = 2;
9 const TEST_BUDGET_TIME = new Date().getTime(); 9 const TEST_BUDGET_TIME = new Date().getTime();
10 10
11 let budgetServiceMock = loadMojoModules( 11 let budgetServiceMock = loadMojoModules(
12 'budgetServiceMock', 12 'budgetServiceMock',
13 ['third_party/WebKit/public/platform/modules/budget_service/budget_service.m ojom', 13 ['third_party/WebKit/public/platform/modules/budget_service/budget_service.m ojom',
14 'mojo/public/js/bindings' 14 'mojo/public/js/bindings'
15 ]).then(mojo => { 15 ]).then(mojo => {
16 const [budgetService, bindings] = mojo.modules; 16 const [budgetService, bindings] = mojo.modules;
17 17
18 class BudgetServiceMock { 18 class BudgetServiceMock {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return Promise.resolve({ error_type: this.error_, budget: this.budget_ }); 83 return Promise.resolve({ error_type: this.error_, budget: this.budget_ });
84 } 84 }
85 85
86 // This provides an implementation for the Mojo serivce reserve call. 86 // This provides an implementation for the Mojo serivce reserve call.
87 reserve() { 87 reserve() {
88 return Promise.resolve({ error_type: this.error_, success: this.success_ } ); 88 return Promise.resolve({ error_type: this.error_, success: this.success_ } );
89 } 89 }
90 } 90 }
91 return new BudgetServiceMock(mojo.interfaces); 91 return new BudgetServiceMock(mojo.interfaces);
92 }); 92 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698