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

Unified Diff: chrome/test/data/extensions/platform_apps/launch_file/test.js

Issue 10332071: Pass command line arguments onto platform apps which provide the right intent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows tests fixed Created 8 years, 7 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
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..210234e662bd729038c36df7693123a15a38a735
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/launch_file/test.js
@@ -0,0 +1,35 @@
+// 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.assertEq(launchData.intent.action,
+ "http://webintents.org/view");
+ chrome.test.assertEq(launchData.intent.type,
+ "chrome-extension://fileentry");
+ 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.assertEq(
+ reader.result.indexOf("This is a test. Word."), 0);
+ chrome.test.succeed();
+ };
+ reader.onerror = function(e) {
+ chrome.test.fail("Error reading file contents.");
+ };
+ reader.readAsText(file);
+ });
+ }
+ ]);
+}
+
+chrome.experimental.app.onLaunched.addListener(onLaunched);

Powered by Google App Engine
This is Rietveld 408576698