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

Unified Diff: chrome/test/data/extensions/api_test/offscreen_tabs/tab_util.js

Issue 9234042: Re-land alexbost's experimental offscreenTabs API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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
« no previous file with comments | « chrome/test/data/extensions/api_test/offscreen_tabs/mouse_events.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/offscreen_tabs/tab_util.js
diff --git a/chrome/test/data/extensions/api_test/offscreen_tabs/tab_util.js b/chrome/test/data/extensions/api_test/offscreen_tabs/tab_util.js
new file mode 100644
index 0000000000000000000000000000000000000000..3494a7cec00abb9cb572862c387f8868b72f31b0
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/offscreen_tabs/tab_util.js
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 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 pass = chrome.test.callbackPass;
+var fail = chrome.test.callbackFail;
+var assertEq = chrome.test.assertEq;
+var assertTrue = chrome.test.assertTrue;
+var assertFalse = chrome.test.assertFalse;
+
+var Q_KEY = 113;
+
+function assertEqTabs(tab1, tab2) {
+ assertEq(tab1.id, tab2.id);
+ assertSimilarTabs(tab1, tab2);
+}
+
+function maybeExpandURL(url) {
+ if (url.match('chrome-extension'))
+ return url;
+ return chrome.extension.getURL(url);
+}
+
+function assertSimilarTabs(tab1, tab2) {
+ assertEq(maybeExpandURL(tab1.url), maybeExpandURL(tab2.url));
+ assertEq(tab1.width, tab2.width);
+ assertEq(tab1.height, tab2.height);
+}
+
+function assertTabDoesNotExist(tabId) {
+ var expectedError = 'No offscreen tab with id: ' + tabId + '.';
+ chrome.experimental.offscreenTabs.get(tabId, fail(expectedError));
+}
+
+function getBaseMouseEvent() {
+ return {
+ button: 0,
+ altKey: false,
+ ctrlKey: false,
+ shiftKey: false
+ };
+};
+
+function getKeyboardEvent(keyCode) {
+ return {
+ type: 'keypress',
+ charCode: keyCode,
+ keyCode: keyCode,
+ altKey: false,
+ ctrlKey: false,
+ shiftKey: false
+ };
+}
« no previous file with comments | « chrome/test/data/extensions/api_test/offscreen_tabs/mouse_events.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698