Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / automation / tests / tabs / location.js
1 // Copyright 2014 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 var allTests = [
6   function testLocation() {
7     function assertOkButtonLocation(event) {
8       var okButton = tree.root.firstChild().firstChild();
9       assertTrue('location' in okButton);
10       assertEq({left:100, top: 200, width: 300, height: 400},
11                okButton.location);
12       chrome.test.succeed();
13     };
14
15     var okButton = tree.root.firstChild().firstChild();
16     assertTrue('location' in okButton, 'no location in okButton');
17     assertTrue('left' in okButton.location, 'no left in location');
18     assertTrue('top' in okButton.location, 'no top in location');
19     assertTrue('height' in okButton.location, 'no height in location');
20     assertTrue('width' in okButton.location, 'no width in location');
21
22     tree.root.addEventListener('children_changed', assertOkButtonLocation);
23     chrome.tabs.executeScript({ 'code':
24           'document.querySelector("button")' +
25           '.setAttribute("style", "position: absolute; left: 100; top: 200; ' +
26           'width: 300; height: 400;");' });
27   }
28 ];
29
30 setUpAndRunTests(allTests);