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

Unified Diff: chrome/test/data/extensions/api_test/tabs/basics/crud.js

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/crud.js
===================================================================
--- chrome/test/data/extensions/api_test/tabs/basics/crud.js (revision 0)
+++ chrome/test/data/extensions/api_test/tabs/basics/crud.js (revision 0)
@@ -0,0 +1,129 @@
+// 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.
+
+var firstWindowId;
+
+chrome.test.runTests([
+ function getSelected() {
+ chrome.tabs.getSelected(null, pass(function(tab) {
+ assertEq(location.href, tab.url);
+ assertEq(location.href, tab.title);
+ firstWindowId = tab.windowId;
+ }));
+ },
+
+ function create() {
+ chrome.tabs.create({"windowId" : firstWindowId, "active" : false},
+ pass(function(tab){
+ assertEq(1, tab.index);
+ assertEq(firstWindowId, tab.windowId);
+ assertEq(false, tab.selected);
+ assertEq("chrome://newtab/", tab.url);
+ assertEq(false, tab.pinned);
+ }));
+ },
+
+ function createInOtherWindow() {
+ chrome.windows.create({}, pass(function(win) {
+ // Create a tab in the older window.
+ chrome.tabs.create({"windowId" : firstWindowId, "active" : false},
+ pass(function(tab) {
+ assertEq(firstWindowId, tab.windowId);
+ }));
+ // Create a tab in this new window.
+ chrome.tabs.create({"windowId" : win.id}, pass(function(tab) {
+ assertEq(win.id, tab.windowId);
+ }));
+ }));
+ },
+
+ function createAtIndex() {
+ chrome.tabs.create({"windowId" : firstWindowId, "index" : 1},
+ pass(function(tab) {
+ assertEq(1, tab.index);
+ }));
+ },
+
+ function createSelected() {
+ chrome.tabs.create({"windowId" : firstWindowId, "active" : true},
+ pass(function(tab) {
+ assertTrue(tab.active && tab.selected);
+ chrome.tabs.getSelected(firstWindowId, pass(function(selectedTab) {
+ assertEq(tab.id, selectedTab.id);
+ }));
+ }));
+ },
+
+ function createWindowWithDefaultTab() {
+ var verify_default = function() {
+ return pass(function(win) {
+ assertEq(1, win.tabs.length);
+ assertEq("chrome://newtab/", win.tabs[0].url);
+ });
+ };
+
+ // Make sure the window always has the NTP when no URL is supplied.
+ chrome.windows.create({}, verify_default());
+ chrome.windows.create({url:[]}, verify_default());
+ },
+
+ function createWindowWithExistingTab() {
+ // Create a tab in the old window
+ chrome.tabs.create({"windowId" : firstWindowId, "url": pageUrl('a'),
+ "active" : false},
+ pass(function(tab) {
+ assertEq(firstWindowId, tab.windowId);
+ assertEq(pageUrl('a'), tab.url);
+
+ // Create a new window with this tab
+ chrome.windows.create({"tabId": tab.id}, pass(function(win) {
+ assertEq(1, win.tabs.length);
+ assertEq(tab.id, win.tabs[0].id);
+ assertEq(win.id, win.tabs[0].windowId);
+ assertEq(pageUrl('a'), win.tabs[0].url);
+ }));
+ }));
+ },
+
+ function getAllInWindowNullArg() {
+ chrome.tabs.getAllInWindow(null, pass(function(tabs) {
+ assertEq(5, tabs.length);
+ assertEq(firstWindowId, tabs[0].windowId);
+ }));
+ },
+
+ function detectLanguage() {
+ chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) {
+ chrome.tabs.detectLanguage(tabs[0].id, pass(function(lang) {
+ assertEq("und", lang);
+ }));
+ }));
+ },
+
+ function windowCreate() {
+ chrome.windows.create({type: "popup"}, pass(function(window) {
+ assertEq("popup", window.type);
+ assertTrue(!window.incognito);
+ }));
+ chrome.windows.create({incognito: true}, pass(function(window) {
+ // This extension is not incognito-enabled, so it shouldn't be able to
+ // see the incognito window.
+ assertEq(null, window);
+ }));
+ },
+
+ /* Disabled -- see http://bugs.chromium.org/58229.
+ function windowSetFocused() {
+ chrome.windows.getCurrent(function(oldWin) {
+ chrome.windows.create({}, function(newWin) {
+ assertTrue(newWin.focused);
+ chrome.windows.update(oldWin.id, {focused:true});
+ chrome.windows.get(oldWin.id, pass(function(oldWin2) {
+ assertTrue(oldWin2.focused);
+ }));
+ });
+ });
+ },
+ */
+]);

Powered by Google App Engine
This is Rietveld 408576698