| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/renderer/extensions/extension_process_bindings.h" | 10 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 "Uncaught Error: Invalid value for argument 1. " | 415 "Uncaught Error: Invalid value for argument 1. " |
| 416 "Expected 'function' but got 'integer'."); | 416 "Expected 'function' but got 'integer'."); |
| 417 | 417 |
| 418 ExpectJsPass("chrome.tabs.remove(2, function(){})", | 418 ExpectJsPass("chrome.tabs.remove(2, function(){})", |
| 419 "RemoveTab", "2"); | 419 "RemoveTab", "2"); |
| 420 | 420 |
| 421 ExpectJsPass("chrome.tabs.remove(2)", | 421 ExpectJsPass("chrome.tabs.remove(2)", |
| 422 "RemoveTab", "2"); | 422 "RemoveTab", "2"); |
| 423 } | 423 } |
| 424 | 424 |
| 425 TEST_F(ExtensionAPIClientTest, GetVisibleTabCapture) { |
| 426 ExpectJsFail("chrome.tabs.getVisibleTabCapture(0);", |
| 427 "Uncaught Error: Parameter 1 is required."); |
| 428 |
| 429 ExpectJsFail("chrome.tabs.getVisibleTabCapture(function(){}, 0)", |
| 430 "Uncaught Error: Invalid value for argument 0. " |
| 431 "Expected 'integer' but got 'function'."); |
| 432 |
| 433 ExpectJsPass("chrome.tabs.getVisibleTabCapture(null, function(img){});", |
| 434 "GetVisibleTabCapture", "null"); |
| 435 } |
| 436 |
| 425 // Bookmark API tests | 437 // Bookmark API tests |
| 426 // TODO(erikkay) add more variations here | 438 // TODO(erikkay) add more variations here |
| 427 | 439 |
| 428 TEST_F(ExtensionAPIClientTest, CreateBookmark) { | 440 TEST_F(ExtensionAPIClientTest, CreateBookmark) { |
| 429 ExpectJsFail( | 441 ExpectJsFail( |
| 430 "chrome.bookmarks.create({parentId:'x', title:0}, function(){})", | 442 "chrome.bookmarks.create({parentId:'x', title:0}, function(){})", |
| 431 "Uncaught Error: Invalid value for argument 0. " | 443 "Uncaught Error: Invalid value for argument 0. " |
| 432 "Property 'parentId': Expected 'integer' but got 'string', " | 444 "Property 'parentId': Expected 'integer' but got 'string', " |
| 433 "Property 'title': Expected 'string' but got 'integer'."); | 445 "Property 'title': Expected 'string' but got 'integer'."); |
| 434 | 446 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 "EnablePageAction", | 523 "EnablePageAction", |
| 512 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," | 524 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," |
| 513 "\"title\":\"a\",\"iconId\":0}]"); | 525 "\"title\":\"a\",\"iconId\":0}]"); |
| 514 | 526 |
| 515 // Now try disablePageAction. | 527 // Now try disablePageAction. |
| 516 ExpectJsPass("chrome.pageActions.disableForTab(" | 528 ExpectJsPass("chrome.pageActions.disableForTab(" |
| 517 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", | 529 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", |
| 518 "DisablePageAction", | 530 "DisablePageAction", |
| 519 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); | 531 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); |
| 520 } | 532 } |
| OLD | NEW |