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
3 // found in the LICENSE file.
7 console.log("audible start");
9 function getOnlyTab() {
10 var views = chrome.extension.getViews({type: "tab"});
11 assertEq(1, views.length);
15 chrome.test.runTests([
16 function setupWindow() {
17 console.log("setupwindow");
19 chrome.tabs.getCurrent(pass(function(tab) {
24 function audibleStartsFalse() {
25 console.log("audiblestartsfirst");
27 chrome.tabs.get(testTabId_, pass(function(tab) {
28 assertEq(false, tab.audible);
29 queryForTab(testTabId_, {audible: false}, pass(function(tab) {
30 assertEq(false, tab.audible);
32 queryForTab(testTabId_, {audible: true}, pass(function(tab) {
38 function audibleUpdateAttemptShouldFail() {
39 var error_msg = "Invalid value for argument 2. Property 'audible': " +
40 "Unexpected property.";
44 chrome.tabs.update(testTabId_, {audible: true}, function(tab) {
45 chrome.test.fail("Updated audible property via chrome.tabs.update");
49 assertEq(error_msg, e.message);
50 chrome.test.succeed();
54 function makeAudible() {
55 onUpdatedExpect("audible", true, null);
56 window.sinewave.play(getOnlyTab(), 200);
59 function testStaysAudibleAfterChangingWindow() {
60 chrome.windows.create({}, pass(function(window)
62 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1},
64 assertEq(true, tab.audible);
69 function makeNotAudible() {
70 onUpdatedExpect("audible", false, null);
71 window.sinewave.stop(getOnlyTab());