- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / browser_action / popup / popup.js
1 // Copyright (c) 2011 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 notify_pass() {
6   // We should be done.  Let the test harness know.
7   chrome.test.notifyPass();
8 }
9
10 function run_tests() {
11   // Compute the size of the popup.
12   var width = 0;
13   var height = 0;
14   if (localStorage.height) {
15     height = parseInt(localStorage.height);
16   }
17   if (localStorage.width) {
18     width = parseInt(localStorage.width);
19   }
20
21   // Set the div's size.
22   var test = document.getElementById("test");
23   test.style.width = width + "px";
24   test.style.height = height + "px";
25   chrome.test.log("height: " + test.offsetHeight);
26   chrome.test.log("width: " + test.offsetWidth);
27
28   height += 500;
29   width += 500;
30   localStorage.height = JSON.stringify(height);
31   localStorage.width = JSON.stringify(width);
32
33   // Allow for the pop-up resize to happen (asynchronously)
34   // before saying that the test is done.
35   window.setTimeout(notify_pass, 0);
36 }
37
38 window.addEventListener("load", function() {
39     window.setTimeout(run_tests, 0)
40 }, false);