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

Unified Diff: LayoutTests/push_messaging/push-messaging.html

Issue 367063002: Push API: set mock behavior from layout tests and exercise success. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/push_messaging/push-messaging-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/push_messaging/push-messaging.html
diff --git a/LayoutTests/push_messaging/push-messaging.html b/LayoutTests/push_messaging/push-messaging.html
index e9f06200936b6917902d607f903ea7d03aa65b2d..0e759dc0352148309adb41583128c0fbad3315f0 100644
--- a/LayoutTests/push_messaging/push-messaging.html
+++ b/LayoutTests/push_messaging/push-messaging.html
@@ -14,18 +14,35 @@ window.jsTestIsAsync = true;
shouldBeTrue('!!navigator.push');
shouldBeTrue('!!navigator.push.register');
+
+window.testRunner.setMockPushClientSuccess('endpoint', 'registrationId');
shouldBe('navigator.push.register("senderId").constructor', 'Promise');
Peter Beverloo 2014/07/02 16:40:47 Exposure of the API (and the properties/functions
Michael van Ouwerkerk 2014/07/03 14:16:41 Done.
-// Currently we have an empty implementation that always fails.
-navigator.push.register('senderId').then(function successCallback() {
- testFailed('Success callback invoked unexpectedly.');
- finishJSTest();
-}, function errorCallback(e) {
- error = e;
- shouldBeEqualToString('error.name', 'AbortError');
- finishJSTest();
-});
+function testPushRegistrationError() {
+ window.testRunner.setMockPushClientError('message');
Peter Beverloo 2014/07/02 16:40:47 Four space indent, please.
Michael van Ouwerkerk 2014/07/03 14:16:41 Done.
+ navigator.push.register('senderId').then(function() {
+ testFailed('Success callback invoked unexpectedly.');
+ testPushRegistrationSuccess();
+ }, function(e) {
+ error = e;
+ shouldBeEqualToString('error.name', 'AbortError');
+ testPushRegistrationSuccess();
+ });
+}
+testPushRegistrationError();
+function testPushRegistrationSuccess() {
+ window.testRunner.setMockPushClientSuccess('endpoint', 'registrationId');
+ navigator.push.register('senderId').then(function(reg) {
+ registration = reg;
+ shouldBeEqualToString('registration.pushEndpoint', 'endpoint');
+ shouldBeEqualToString('registration.pushRegistrationId', 'registrationId');
+ finishJSTest();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly.');
+ finishJSTest();
+ });
+}
</script>
</body>
</html>
« no previous file with comments | « no previous file | LayoutTests/push_messaging/push-messaging-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698