diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 00:41:44 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 00:41:44 +0000 |
commit | 5b1a04b49b0b58b8268415118c89f3056cbd1fac (patch) | |
tree | a81fc292bcfc9c2b36b826dd6253d89a5339e06c /chrome/test/data | |
parent | 15c532e6a94646f9d5ed40af9bcb60a28a30a7ec (diff) | |
download | chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.zip chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.tar.gz chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.tar.bz2 |
Allow platform apps to open links in the browser.
Triggered via <a href="..." target="_blank"> or window.open('...').
R=miket@chromium.org
BUG=130213
Review URL: https://chromiumcodereview.appspot.com/10534147
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data')
5 files changed, 61 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/platform_apps/open_link/link.html b/chrome/test/data/extensions/platform_apps/open_link/link.html new file mode 100644 index 0000000..1665045 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/link.html @@ -0,0 +1,10 @@ +<!-- + * 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. +--> +<html> +<body> +I am a remote link. +</body> +</html> diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.html b/chrome/test/data/extensions/platform_apps/open_link/main.html new file mode 100644 index 0000000..783d5f0 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/main.html @@ -0,0 +1,11 @@ +<!-- + * 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. +--> +<html> +<body> +<a id="test-link" target="_blank">Click me</a> +<script src="main.js"></script> +</body> +</html> diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.js b/chrome/test/data/extensions/platform_apps/open_link/main.js new file mode 100644 index 0000000..ddd0c8a --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/main.js @@ -0,0 +1,19 @@ +// 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. + +chrome.test.getConfig(function(config) { + var linkNode = document.getElementById('test-link'); + linkNode.href = 'http://localhost:' + config.testServer.port + + '/files/extensions/platform_apps/open_link/link.html'; + + var clickEvent = document.createEvent('MouseEvents'); + clickEvent.initMouseEvent('click', true, true, window, + 0, 0, 0, 0, 0, false, false, + false, false, 0, null); + linkNode.dispatchEvent(clickEvent); +}); + +onmessage = function() { + chrome.test.sendMessage('Link opened'); +}; diff --git a/chrome/test/data/extensions/platform_apps/open_link/manifest.json b/chrome/test/data/extensions/platform_apps/open_link/manifest.json new file mode 100644 index 0000000..fc44eb4 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/manifest.json @@ -0,0 +1,14 @@ +{ + "name": "Platform App Test: minimal platform app", + "version": "1", + "manifest_version": 2, + "permissions": [ + "experimental", + "appWindow" + ], + "app": { + "background": { + "scripts": ["test.js"] + } + } +} diff --git a/chrome/test/data/extensions/platform_apps/open_link/test.js b/chrome/test/data/extensions/platform_apps/open_link/test.js new file mode 100644 index 0000000..ce719f7 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/test.js @@ -0,0 +1,7 @@ +// 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. + +chrome.experimental.app.onLaunched.addListener(function() { + chrome.appWindow.create('main.html', {}, function () {}); +}); |