Index: third_party/WebKit/LayoutTests/http/tests/budget/get-cost.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/get-cost.html b/third_party/WebKit/LayoutTests/http/tests/budget/get-cost.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..17afd45b17a89954b33d57a00c728beabfbfb21e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/get-cost.html |
@@ -0,0 +1,37 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>Budget API: Makes basic getCost and getBudget calls.</title> |
+ <script src="../resources/testharness.js"></script> |
+ <script src="../resources/testharnessreport.js"></script> |
+ <script src="/js-test-resources/mojo-helpers.js"></script> |
+ <script src="budget-service-mock.js"></script> |
+ </head> |
+ <body> |
+ <script> |
+ if (!window.mojo) |
+ debug('This test can not run without mojo'); |
+ |
+ promise_test(function() { |
+ return budgetServiceMock.then(mock => { |
+ assert_own_property(Navigator.prototype, 'budget'); |
+ return navigator.budget.getCost("silent-push"); |
+ }).then(cost => { |
+ assert_equals(cost, TEST_BUDGET_COST); |
Peter Beverloo
2016/08/23 09:46:39
dito. Also on line 29
harkness
2016/08/23 10:06:17
Done.
|
+ }); |
+ }, 'BudgetService mock for GetCost should return correct results.'); |
+ |
+ promise_test(function() { |
+ return budgetServiceMock.then(mock => { |
+ assert_own_property(Navigator.prototype, 'budget'); |
+ return navigator.budget.getCost("push"); |
Peter Beverloo
2016/08/23 09:46:39
nit: I'd choose something that's obviously fake. W
harkness
2016/08/23 10:06:17
Done.
|
+ }).then(cost => { |
+ assert_unreached('getCost should have failed with an invalid argument.'); |
+ }, function(error) { |
+ assert_equals(error.name, 'TypeError'); |
+ assert_equals(error.message, "Failed to execute 'getCost' on 'BudgetService': The provided value 'push' is not a valid enum value of type ActionType."); |
+ }); |
+ }, 'BudgetService mock for GetCost should return correct results.'); |
+ </script> |
+ </body> |
+</html> |