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

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: tests; also mutedCause is a part of the tab object and capture mutedCause changed to just 'capture' Created 5 years, 7 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) 2011 The Chromium Authors. All rights reserved.
not at google - send to devlin 2015/05/26 23:09:48 2015
Jared Sohn 2015/05/27 14:52:02 Done (also changed muted.js, sinewave.js, and disa
not at google - send to devlin 2015/05/28 23:04:42 Correct.
not at google - send to devlin 2015/06/01 20:33:56 btw we also now leave the (c) out, for the record.
Jared Sohn 2015/06/02 08:54:38 Updated in new files.
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 {
not at google - send to devlin 2015/05/26 23:09:48 Open brace should be on same line as function name
Jared Sohn 2015/05/27 14:52:02 Done.
9 var views = chrome.extension.getViews({type: "tab"});
10 assertEq(1, views.length);
11 var scriptElem = views[0].document.createElement("script");
12 scriptElem.type = "text/javascript";
13 scriptElem.src = filename;
14 views[0].document.body.appendChild(scriptElem);
not at google - send to devlin 2015/05/26 23:09:48 Instead of this you should be able to do something
Jared Sohn 2015/05/27 14:52:02 Would doing this match your suggestion? -- create
not at google - send to devlin 2015/05/28 23:04:42 Sounds good to me.
15 }
16
17 chrome.test.runTests([
18 function setupWindow() {
19 chrome.tabs.getCurrent(pass(function(tab) {
20 testTabId_ = tab.id;
miu 2015/05/26 21:28:47 kalman@'s more familiar with the JS extension test
not at google - send to devlin 2015/05/26 23:09:47 Very confusingly, callbackPass (which pass is alia
Jared Sohn 2015/05/27 14:52:02 Correct. I am using pass here to be consistent wit
21 }));
22 },
23
24 function audibleStartsFalse() {
25 chrome.tabs.get(testTabId_, pass(function(tab) {
26 assertEq(false, tab.audible);
27 checkQuery(testTabId_, "audible", false, true, null);
28 checkQuery(testTabId_, "audible", true, false, null);
29 }));
30 },
31
32 function audibleUpdateAttempt() {
miu 2015/05/26 21:28:46 naming nit: How about audibleUpdateAttemptShouldFa
Jared Sohn 2015/05/27 14:52:02 Done.
33 var error_msg = "Invalid value for argument 2. Property 'audible': " +
34 "Unexpected property.";
35
36 try
37 {
38 chrome.tabs.update(testTabId_, {audible: true}, function(tab) {
39 chrome.test.fail("Updated audible property via chrome.tabs.update");
40 });
41 } catch (e)
42 {
43 assertEq(error_msg, e.message);
44 chrome.test.succeed();
45 }
46 },
47
48 function makeAudible() {
49 onUpdatedExpect("audible", true, null);
50 injectScriptIntoOnlyTab("sinewave.js");
51 },
52
53 function testStaysAudibleAfterChangingWindow() {
miu 2015/05/26 21:28:46 Not sure if it's necessary to test the state after
Jared Sohn 2015/05/27 14:52:02 The intention behind this test is because this pat
miu 2015/05/27 20:10:14 Okay. Sounds good to me. :)
54 chrome.windows.create({}, pass(function(window)
55 {
56 chrome.tabs.move(testTabId_, {windowId: window.id, index: -1},
57 pass(function(tab) {
58 assertEq(true, tab.audible);
59 }));
60 }));
61 },
62
63 function makeNotAudible() {
64 onUpdatedExpect("audible", false, null);
65 injectScriptIntoOnlyTab("disable_sinewave.js");
66 }
67 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698