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

Side by Side Diff: chrome/test/data/extensions/api_test/webintent_handler/background.js

Issue 12223086: Update app runtime custom bindings to handle no WebIntents launch data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More stuff removed Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 /*
6 This extension is a platform app that provides a Web Intent handler; it accepts
7 incoming requests and invokes chrome.test.succeed() immediately.
8 */
9
10 function launchedListener(launchData) {
11 chrome.test.assertFalse(!launchData, "No launchData");
12 chrome.test.assertFalse(!launchData.intent, "No launchData.intent");
13 chrome.test.assertEq(launchData.intent.action,
14 "http://webintents.org/view");
15 chrome.test.assertEq(launchData.intent.type,
16 "chrome-extension://fileentry");
17 chrome.test.assertFalse(!launchData.intent.data,
18 "No launchData.intent.data");
19
20 launchData.intent.data.file(function(file) {
21 var reader = new FileReader();
22 reader.onloadend = function(e) {
23 chrome.test.assertEq("hello, world!", reader.result);
24 chrome.test.succeed();
25 };
26 reader.onerror = function(e) {
27 chrome.test.fail("Error reading file contents.");
28 };
29 reader.readAsText(file);
30 });
31 }
32
33 chrome.app.runtime.onLaunched.addListener(launchedListener);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698