Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/launch_file/test.js |
| diff --git a/chrome/test/data/extensions/platform_apps/launch_file/test.js b/chrome/test/data/extensions/platform_apps/launch_file/test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bb45c6741611071373cb97bfa3f6226ba73eecad |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/platform_apps/launch_file/test.js |
| @@ -0,0 +1,37 @@ |
| +// 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. |
| + |
| +// Test that there is a launchData.intent, it is set up proerly, and that the |
| +// FileEntry in launchData.intent.data can be read. |
| +function onLaunched(launchData) { |
| + chrome.test.runTests([ |
| + function testIntent() { |
| + chrome.test.assertFalse(!launchData, "No launchData"); |
| + chrome.test.assertFalse(!launchData.intent, "No launchData.intent"); |
| + chrome.test.assertTrue( |
|
Mihai Parparita -not on Chrome
2012/05/18 04:26:04
You can use chrome.test.assertEq, so that you don'
benwells
2012/05/22 13:15:03
Done.
|
| + launchData.intent.action == "http://webintents.org/view", |
| + "launchData.intent.action incorrect: " + launchData.intent.action); |
| + chrome.test.assertTrue(launchData.intent.type == "text/plain", |
| + "launchData.intent.type incorrect: " + launchData.intent.type); |
| + chrome.test.assertFalse(!launchData.intent.data, |
| + "No launchData.intent.data"); |
| + |
| + launchData.intent.data.file(function(file) { |
| + var reader = new FileReader(); |
| + reader.onloadend = function(e) { |
| + chrome.test.assertTrue( |
| + reader.result.indexOf("This is a test. Word.") == 0, |
| + "File contents incorrect: " + reader.result); |
| + chrome.test.succeed(); |
| + }; |
| + reader.onerror = function(e) { |
| + chrome.test.fail("Error reading file contents."); |
| + }; |
| + reader.readAsText(file); |
| + }); |
| + } |
| + ]); |
| +} |
| + |
| +chrome.experimental.app.onLaunched.addListener(onLaunched); |