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

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: header file order fixed Created 5 years, 6 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 (c) 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 function injectScriptIntoOnlyTab(filename) {
8 var views = chrome.extension.getViews({type: "tab"});
9 assertEq(1, views.length);
10 var scriptElem = views[0].document.createElement("script");
11 scriptElem.type = "text/javascript";
12 scriptElem.src = filename;
13 views[0].document.body.appendChild(scriptElem);
14 }
15
16 chrome.test.runTests([
17 function setupWindow() {
18 chrome.tabs.getCurrent(pass(function(tab) {
19 testTabId_ = tab.id;
20 }));
21 },
22
23 function audibleStartsFalse() {
24 chrome.tabs.get(testTabId_, pass(function(tab) {
25 assertEq(false, tab.audible);
26 checkQuery(testTabId_, "audible", false, true, null);
27 checkQuery(testTabId_, "audible", true, false, null);
28 }));
29 },
30
31 function audibleUpdateAttemptShouldFail() {
32 var error_msg = "Invalid value for argument 2. Property 'audible': " +
33 "Unexpected property.";
34
35 try
36 {
37 chrome.tabs.update(testTabId_, {audible: true}, function(tab) {
38 chrome.test.fail("Updated audible property via chrome.tabs.update");
39 });
40 } catch (e)
41 {
42 assertEq(error_msg, e.message);
43 chrome.test.succeed();
44 }
45 },
46
47 function makeAudible() {
48 onUpdatedExpect("audible", true, null);
49 injectScriptIntoOnlyTab("sinewave.js");
50 },
51
52 function testStaysAudibleAfterChangingWindow() {
53 chrome.windows.create({}, pass(function(window)
54 {
55 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1},
56 pass(function(tab) {
57 assertEq(true, tab.audible);
58 }));
59 }));
60 },
61
62 function makeNotAudible() {
63 onUpdatedExpect("audible", false, null);
64 injectScriptIntoOnlyTab("disable_sinewave.js");
65 }
66 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698