Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var testTabId_; | 5 var testTabId_; |
| 6 | 6 |
| 7 console.log("audible start"); | 7 console.log("audible start"); |
| 8 | 8 |
| 9 function getOnlyTab() { | 9 function getOnlyTab() { |
| 10 var views = chrome.extension.getViews({type: "tab"}); | 10 var views = chrome.extension.getViews({type: "tab"}); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 queryForTab(testTabId_, {audible: false}, pass(function(tab) { | 29 queryForTab(testTabId_, {audible: false}, pass(function(tab) { |
| 30 assertEq(false, tab.audible); | 30 assertEq(false, tab.audible); |
| 31 })); | 31 })); |
| 32 queryForTab(testTabId_, {audible: true}, pass(function(tab) { | 32 queryForTab(testTabId_, {audible: true}, pass(function(tab) { |
| 33 assertEq(null, tab); | 33 assertEq(null, tab); |
| 34 })); | 34 })); |
| 35 })); | 35 })); |
| 36 }, | 36 }, |
| 37 | 37 |
| 38 function audibleUpdateAttemptShouldFail() { | 38 function audibleUpdateAttemptShouldFail() { |
| 39 var error_msg = "Invalid value for argument 2. Property 'audible': " + | 39 var jsBindingsError = |
|
lazyboy
2017/05/25 21:46:42
nit: jsBindingsExpectedError or expectedJSBindings
Devlin
2017/05/26 01:34:12
Done.
| |
| 40 "Unexpected property."; | 40 'Invalid value for argument 2. Property \'audible\': ' + |
| 41 'Unexpected property.'; | |
| 42 var nativeBindingsError = | |
| 43 'Error in invocation of tabs.update(' + | |
| 44 'optional integer tabId, object updateProperties, ' + | |
| 45 'optional function callback): Error at parameter ' + | |
| 46 '\'updateProperties\': Unexpected property: \'audible\'.'; | |
| 41 | 47 |
| 42 try | 48 try { |
| 43 { | |
| 44 chrome.tabs.update(testTabId_, {audible: true}, function(tab) { | 49 chrome.tabs.update(testTabId_, {audible: true}, function(tab) { |
| 45 chrome.test.fail("Updated audible property via chrome.tabs.update"); | 50 chrome.test.fail('Updated audible property via chrome.tabs.update'); |
| 46 }); | 51 }); |
| 47 } catch (e) | 52 } catch (e) { |
| 48 { | 53 assertTrue(e.message == jsBindingsError || |
| 49 assertEq(error_msg, e.message); | 54 e.message == nativeBindingsError, |
| 55 e.message); | |
| 50 chrome.test.succeed(); | 56 chrome.test.succeed(); |
| 51 } | 57 } |
| 52 }, | 58 }, |
| 53 | 59 |
| 54 function makeAudible() { | 60 function makeAudible() { |
| 55 onUpdatedExpect("audible", true, null); | 61 onUpdatedExpect("audible", true, null); |
| 56 window.sinewave.play(getOnlyTab(), 200); | 62 window.sinewave.play(getOnlyTab(), 200); |
| 57 }, | 63 }, |
| 58 | 64 |
| 59 function testStaysAudibleAfterChangingWindow() { | 65 function testStaysAudibleAfterChangingWindow() { |
| 60 chrome.windows.create({}, pass(function(window) | 66 chrome.windows.create({}, pass(function(window) |
| 61 { | 67 { |
| 62 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1}, | 68 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1}, |
| 63 pass(function(tab) { | 69 pass(function(tab) { |
| 64 assertEq(true, tab.audible); | 70 assertEq(true, tab.audible); |
| 65 })); | 71 })); |
| 66 })); | 72 })); |
| 67 }, | 73 }, |
| 68 | 74 |
| 69 function makeNotAudible() { | 75 function makeNotAudible() { |
| 70 onUpdatedExpect("audible", false, null); | 76 onUpdatedExpect("audible", false, null); |
| 71 window.sinewave.stop(getOnlyTab()); | 77 window.sinewave.stop(getOnlyTab()); |
| 72 } | 78 } |
| 73 ]); | 79 ]); |
| OLD | NEW |