Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/window_api/test.js |
| diff --git a/chrome/test/data/extensions/platform_apps/window_api/test.js b/chrome/test/data/extensions/platform_apps/window_api/test.js |
| index 42f8a4067e08c41b85e85b7be90b542521e0d296..eb2e86bb9f967e98bafc6d6eda122809b1107e4a 100644 |
| --- a/chrome/test/data/extensions/platform_apps/window_api/test.js |
| +++ b/chrome/test/data/extensions/platform_apps/window_api/test.js |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| var callbackPass = chrome.test.callbackPass; |
| +var callbackFail = chrome.test.callbackFail; |
| var defaultFuzzFactor = 1; |
| function assertFuzzyEq(expected, actual, fuzzFactor, message) { |
| @@ -559,6 +560,117 @@ function testBadging() { |
| ]); |
| } |
| +function testFrameColors() { |
| + chrome.test.runTests([ |
| + function testWithNoColor() { |
| + chrome.app.window.create('test.html', callbackPass(function(win) { |
| + chrome.test.assertEq(false, win.hasFrameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithFrameNone() { |
| + chrome.app.window.create('test.html', { |
| + frame: 'none' |
| + }, |
| + callbackPass(function(win) { |
| + chrome.test.assertEq(false, win.hasFrameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithBlack() { |
|
Matt Giuca
2014/02/18 06:03:18
I would prefer if one of these tests (black or whi
benwells
2014/02/18 07:47:25
As discussed, color parsing is unit tested.
|
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + type: 'chrome', |
| + color: '#000000' |
| + } |
| + }, |
| + callbackPass(function(win) { |
| + chrome.test.assertEq(true, win.hasFrameColor); |
| + chrome.test.assertEq(-16777216, win.frameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithWhite() { |
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + color: '#FFFFFF' |
| + } |
| + }, |
| + callbackPass(function(win) { |
| + chrome.test.assertEq(true, win.hasFrameColor); |
| + chrome.test.assertEq(-1, win.frameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithWhiteShorthand() { |
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + color: '#FFF' |
| + } |
| + }, |
| + callbackPass(function(win) { |
| + chrome.test.assertEq(true, win.hasFrameColor); |
| + chrome.test.assertEq(-1, win.frameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithFrameAndFrameOptions() { |
| + chrome.app.window.create('test.html', { |
| + frame: 'chrome', |
| + frameOptions: { |
| + color: '#FFF' |
| + } |
| + }, |
| + callbackFail('Only one of frame and frameOptions can be supplied.')); |
| + }, |
| + |
| + function testWithFrameNoneAndColor() { |
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + type: 'none', |
| + color: '#FFF' |
| + } |
| + }, |
| + callbackFail('Windows with no frame cannot have a color.')); |
| + }, |
| + |
| + function testWithInvalidColor() { |
|
Matt Giuca
2014/02/18 06:03:18
Can you also test with an invalid string starting
|
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + color: 'DontWorryBeHappy' |
| + } |
| + }, |
| + callbackFail('The color specification could not be parsed.')); |
| + } |
| + ]); |
| +} |
| + |
| +function testFrameColorsInStable() { |
| + chrome.test.runTests([ |
| + function testWithNoColor() { |
| + chrome.app.window.create('test.html', callbackPass(function(win) { |
| + chrome.test.assertEq(true, win.hasFrameColor); |
| + chrome.test.assertEq(-1, win.frameColor); |
| + win.close(); |
| + })); |
| + }, |
| + |
| + function testWithOptionsGivesError() { |
| + chrome.app.window.create('test.html', { |
| + frameOptions: { |
| + color: '#FFF' |
| + } |
| + }, |
| + callbackFail('frameOptions is only available in dev channel.')); |
| + } |
| + ]); |
| +} |
| + |
| chrome.app.runtime.onLaunched.addListener(function() { |
| chrome.test.sendMessage('Launched', function(reply) { |
| window[reply](); |