Fix SetShape (SetAlphaShape) to allow Null regions (+ tests).
[chromium-blink-merge.git] / chrome / test / data / extensions / platform_apps / windows_api_shape / background.js
blobd7624d2d7d31d4942e48788750b640ad31beb8a8
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.
5 function testWindowShape(testId, region) {
6   var createOptions = { id: testId, frame: 'none' };
8   chrome.app.window.create('index.html',
9                            createOptions,
10                            chrome.test.callbackPass(function(win) {
11       win.setShape(region)
12   }));
15 chrome.app.runtime.onLaunched.addListener(function() {
16   chrome.test.runTests([
18     // Window shape is a single rect.
19     function testWindowShapeSingleRect() {
20       testWindowShape('testWindowShapeSingleRect',
21                       {rects: [{left:100, top:50, width:50, height:100}]});
22     },
24     // Window shape is multiple rects.
25     function testWindowShapeMultipleRects() {
26       testWindowShape('testWindowShapeMultipleRects',
27                       {rects: [{left:100, top:50, width:50, height:100},
28                                {left:200, top:100, width:50, height:50}]});
29     },
31     // Window shape is null.
32     function testWindowShapeNull() {
33       testWindowShape('testWindowShapeNull', {});
34     },
36     // Window shape is empty.
37     function testWindowShapeEmpty() {
38       testWindowShape('testWindowShapeEmpty', {rects: []});
39     },
41   ]);
42 });