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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/tabs/basics/audible.js
diff --git a/chrome/test/data/extensions/api_test/tabs/basics/audible.js b/chrome/test/data/extensions/api_test/tabs/basics/audible.js
new file mode 100644
index 0000000000000000000000000000000000000000..b8b01e6d5489d559f011c32da2c52949eb983115
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tabs/basics/audible.js
@@ -0,0 +1,73 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var testTabId_;
+
+console.log("audible start");
+
+function getOnlyTab() {
+ var views = chrome.extension.getViews({type: "tab"});
+ assertEq(1, views.length);
+ return views[0];
+}
+
+chrome.test.runTests([
+ function setupWindow() {
+ console.log("setupwindow");
+
+ chrome.tabs.getCurrent(pass(function(tab) {
+ testTabId_ = tab.id;
+ }));
+ },
+
+ function audibleStartsFalse() {
+ console.log("audiblestartsfirst");
+
+ chrome.tabs.get(testTabId_, pass(function(tab) {
+ assertEq(false, tab.audible);
+ queryForTab(testTabId_, {audible: false}, pass(function(tab) {
+ assertEq(false, tab.audible);
+ }));
+ queryForTab(testTabId_, {audible: true}, pass(function(tab) {
+ assertEq(null, tab);
+ }));
+ }));
+ },
+
+ function audibleUpdateAttemptShouldFail() {
+ var error_msg = "Invalid value for argument 2. Property 'audible': " +
+ "Unexpected property.";
+
+ try
+ {
+ chrome.tabs.update(testTabId_, {audible: true}, function(tab) {
+ chrome.test.fail("Updated audible property via chrome.tabs.update");
+ });
+ } catch (e)
+ {
+ assertEq(error_msg, e.message);
+ chrome.test.succeed();
+ }
+ },
+
+ function makeAudible() {
+ onUpdatedExpect("audible", true, null);
+ window.sinewave.play(getOnlyTab(), 200);
+ },
+
+ function testStaysAudibleAfterChangingWindow() {
+ chrome.windows.create({}, pass(function(window)
+ {
+ chrome.tabs.move(testTabId_, {windowId: window.id, index: -1},
+ pass(function(tab) {
+ assertEq(true, tab.audible);
+ }));
+ }));
+ },
+
+ function makeNotAudible() {
+ onUpdatedExpect("audible", false, null);
+ window.sinewave.stop(getOnlyTab());
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698