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

Unified Diff: chrome/test/data/extensions/api_test/tabs/basics/events.html

Issue 8762014: Move another set of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/events.html
===================================================================
--- chrome/test/data/extensions/api_test/tabs/basics/events.html (revision 112170)
+++ chrome/test/data/extensions/api_test/tabs/basics/events.html (working copy)
@@ -1,174 +1,7 @@
+<!--
+ * Copyright (c) 2011 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.
+-->
<script src="tabs_util.js"></script>
-
-<script>
-var testTabId;
-var otherTabId;
-var firstWindowId;
-var secondWindowId;
-
-chrome.test.runTests([
- function init() {
- chrome.tabs.getSelected(null, pass(function(tab) {
- testTabId = tab.id;
- firstWindowId = tab.windowId;
- }));
- },
-
- function tabsOnCreated() {
- chrome.test.listenOnce(chrome.tabs.onCreated, function(tab) {
- assertEq(pageUrl("f"), tab.url);
- otherTabId = tab.id;
- assertEq(true, tab.selected);
- });
-
- chrome.tabs.create({"windowId": firstWindowId, "url": pageUrl("f"),
- "selected": true}, pass(function(tab) {}));
- },
-
- function tabsOnUpdatedIgnoreTabArg() {
- // A third argument was added to the onUpdated event callback.
- // Test that an event handler which ignores this argument works.
- var onUpdatedCompleted = chrome.test.listenForever(chrome.tabs.onUpdated,
- function(tabid, changeInfo) {
- if (tabid == otherTabId && changeInfo.status == "complete") {
- onUpdatedCompleted();
- }
- }
- );
-
- chrome.tabs.update(otherTabId, {"url": pageUrl("f")}, pass());
- },
-
- function tabsOnUpdated() {
- var onUpdatedCompleted = chrome.test.listenForever(
- chrome.tabs.onUpdated,
- function(tabid, changeInfo, tab) {
- // |tab| contains the id of the tab it describes.
- // Test that |tabid| matches this id.
- assertEq(tabid, tab.id);
-
- // If |changeInfo| has a status property, than
- // it should match the status of the tab in |tab|.
- if (changeInfo.status) {
- assertEq(changeInfo.status, tab.status);
- }
-
- if (tabid == otherTabId && changeInfo.status == "complete") {
- onUpdatedCompleted();
- }
- }
- );
-
- chrome.tabs.update(otherTabId, {"url": pageUrl("f")}, pass());
- },
-
- function tabsOnMoved() {
- chrome.test.listenOnce(chrome.tabs.onMoved, function(tabid, info) {
- assertEq(otherTabId, tabid);
- });
-
- chrome.tabs.move(otherTabId, {"index": 0}, pass());
- },
-
- function tabsOnSelectionChanged() {
- chrome.test.listenOnce(chrome.tabs.onSelectionChanged,
- function(tabid, info) {
- assertEq(testTabId, tabid);
- }
- );
-
- chrome.tabs.update(testTabId, {"selected": true}, pass());
- },
-
- function setupTabsOnAttachDetach() {
- createWindow([""], {}, pass(function(winId, tabIds) {
- secondWindowId = winId;
- }));
- },
-
- function tabsOnAttached() {
- function moveAndListen(tabId, properties, callback) {
- chrome.test.listenOnce(chrome.tabs.onAttached,
- function(testTabId, info) {
- // Ensure notification is correct.
- assertEq(testTabId, tabId);
- assertEq(properties.windowId, info.newWindowId);
- assertEq(properties.index, info.newPosition);
- if (callback)
- callback();
- });
- chrome.tabs.move(tabId, properties);
- };
-
- // Move tab to second window, then back to first.
- // The original tab/window configuration should be restored.
- // tabsOnDetached() depends on it.
- moveAndListen(testTabId, {"windowId": secondWindowId, "index": 0},
- pass(function() {
- moveAndListen(testTabId, {"windowId": firstWindowId, "index": 1});
- }));
- },
-
- function tabsOnDetached() {
- function moveAndListen(tabId, oldWindowId, oldIndex, properties,
- callback) {
- chrome.test.listenOnce(chrome.tabs.onDetached,
- function(detachedTabId, info) {
- // Ensure notification is correct.
- assertEq(detachedTabId, tabId);
- assertEq(oldWindowId, info.oldWindowId);
- assertEq(oldIndex, info.oldPosition);
- if (callback)
- callback();
- });
- chrome.tabs.move(tabId, properties);
- };
-
- // Move tab to second window, then back to first.
- moveAndListen(testTabId, firstWindowId, 1,
- {"windowId": secondWindowId, "index": 0}, pass(function() {
- moveAndListen(testTabId, secondWindowId, 0,
- {"windowId": firstWindowId, "index": 1});
- }));
- },
-
- function windowsOnCreated() {
- chrome.test.listenOnce(chrome.windows.onCreated, function(window) {
- assertTrue(window.width > 0);
- assertTrue(window.height > 0);
- assertEq("normal", window.type);
- assertTrue(!window.incognito);
- windowEventsWindow = window;
- chrome.tabs.getAllInWindow(window.id, pass(function(tabs) {
- assertEq(pageUrl("a"), tabs[0].url);
- }));
- });
-
- chrome.windows.create({"url": pageUrl("a")}, pass(function(tab) {}));
- },
-
- /*
- This test doesn't work on mac because the Chromium app never gets
- brought to the front. See: crbug.com/60963.
- It also doesn't work on Chrome OS for unknown reasons.
- It also times out on the full XP builder for unknown reasons.
- See: crbug.com/61035.
-
- function windowsOnFocusChanged() {
- chrome.windows.getCurrent(pass(function(windowA) {
- chrome.windows.create({}, pass(function(windowB) {
- chrome.windows.update(windowA.id, {focused: true}, pass(function() {
- chrome.windows.update(windowB.id, {focused: true}, pass(function() {
- chrome.test.listenOnce(chrome.windows.onFocusChanged,
- function(changedWindowId) {
- assertEq(windowEventsWindow.id, changedWindowId);
- });
- chrome.windows.remove(windowB.id);
- }));
- }));
- }));
- }));
- }
- */
-]);
-</script>
+<script src="events.js"></script>
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/e.html ('k') | chrome/test/data/extensions/api_test/tabs/basics/events.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698