- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / uitest / plugins / test.js
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 function callTestInvokeDefault(plugin) {
6   if (plugin.testInvokeDefault) {
7     plugin.testInvokeDefault(function(str) {
8       window.domAutomationController.send(true);
9     });
10     return;
11   }
12
13   // Try again in 100 ms.
14   window.setTimeout(callTestInvokeDefault.bind(null, plugin), 100);
15 }
16
17 function testPluginWorks() {
18   if (!navigator.mimeTypes['application/x-extension-test']) {
19     window.domAutomationController.send(false);
20     return;
21   }
22
23   var plug = document.getElementById("plugin");
24   if (!plug) {
25     window.domAutomationController.send(false);
26     return;
27   }
28   callTestInvokeDefault(plug);
29 }