Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/audible.js

Issue 987583004: Add audible, muted to Tab, c.t.query, c.t.update, and c.t.onUpdated where relevant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch1
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 var testTabId_;
6
7 console.log("audible start");
8
9 function getOnlyTab() {
10 var views = chrome.extension.getViews({type: "tab"});
11 assertEq(1, views.length);
12 return views[0];
13 }
14
15 chrome.test.runTests([
16 function setupWindow() {
17 console.log("setupwindow");
18
19 chrome.tabs.getCurrent(pass(function(tab) {
20 testTabId_ = tab.id;
21 }));
22 },
23
24 function audibleStartsFalse() {
25 console.log("audiblestartsfirst");
26
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);
31 }));
32 queryForTab(testTabId_, {audible: true}, pass(function(tab) {
33 assertEq(null, tab);
34 }));
35 }));
36 },
37
38 function audibleUpdateAttemptShouldFail() {
39 var error_msg = "Invalid value for argument 2. Property 'audible': " +
40 "Unexpected property.";
41
42 try
43 {
44 chrome.tabs.update(testTabId_, {audible: true}, function(tab) {
45 chrome.test.fail("Updated audible property via chrome.tabs.update");
46 });
47 } catch (e)
48 {
49 assertEq(error_msg, e.message);
50 chrome.test.succeed();
51 }
52 },
53
54 function makeAudible() {
55 onUpdatedExpect("audible", true, null);
56 window.sinewave.play(getOnlyTab(), 200);
57 },
58
59 function testStaysAudibleAfterChangingWindow() {
60 chrome.windows.create({}, pass(function(window)
61 {
62 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1},
63 pass(function(tab) {
64 assertEq(true, tab.audible);
65 }));
66 }));
67 },
68
69 function makeNotAudible() {
70 onUpdatedExpect("audible", false, null);
71 window.sinewave.stop(getOnlyTab());
72 }
73 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698