Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/webintent_handler/background.js |
| diff --git a/chrome/test/data/extensions/api_test/webintent_handler/background.js b/chrome/test/data/extensions/api_test/webintent_handler/background.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6d661afbe08537e268274108466e41ae17d1c0b3 |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/webintent_handler/background.js |
| @@ -0,0 +1,25 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/* |
| +This extension is a platform app that provides a Web Intent handler; it accepts |
| +incoming requests and invokes chrome.test.succeed() immediately. |
| +*/ |
| + |
| +function launchedListener(args) { |
| + if (!(args && args['intent'])) { |
| + chrome.test.fail('Expected web intent on args: ' + args); |
| + return; |
| + } |
| + var intent = args['intent']; |
| + chrome.test.assertEq('http://webintents.org/view', intent['action']); |
|
tbarzic
2012/09/19 15:45:13
optionally, you can verify the intent file is read
|
| + chrome.test.succeed(); |
| + |
| + // Note that we're not using chrome.extension.sendRequest here to call back |
|
tbarzic
2012/09/19 15:45:13
nit: you probably don't need this comment anymore
|
| + // to the source app - the call is not available in v2 packaged apps. The |
| + // most we can do for now is succeed or fail the test (to be caught by a |
| + // ResultCatcher in external_filesystem_apitest.cc). |
| +} |
| + |
| +chrome.app.runtime.onLaunched.addListener(launchedListener); |