| 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 "tabs.remove", "2"); | 419 "tabs.remove", "2"); |
| 420 | 420 |
| 421 ExpectJsPass("chrome.tabs.remove(2)", | 421 ExpectJsPass("chrome.tabs.remove(2)", |
| 422 "tabs.remove", "2"); | 422 "tabs.remove", "2"); |
| 423 } | 423 } |
| 424 | 424 |
| 425 TEST_F(ExtensionAPIClientTest, CaptureVisibleTab) { |
| 426 ExpectJsFail("chrome.tabs.captureVisibleTab(0);", |
| 427 "Uncaught Error: Parameter 1 is required."); |
| 428 |
| 429 ExpectJsFail("chrome.tabs.captureVisibleTab(function(){}, 0)", |
| 430 "Uncaught Error: Invalid value for argument 0. " |
| 431 "Expected 'integer' but got 'function'."); |
| 432 |
| 433 ExpectJsPass("chrome.tabs.captureVisibleTab(null, function(img){});", |
| 434 "tabs.captureVisibleTab", "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:0, title:0}, function(){})", | 442 "chrome.bookmarks.create({parentId:0, title:0}, function(){})", |
| 431 "Uncaught Error: Invalid value for argument 0. " | 443 "Uncaught Error: Invalid value for argument 0. " |
| 432 "Property 'parentId': Expected 'string' but got 'integer', " | 444 "Property 'parentId': Expected 'string' but got 'integer', " |
| 433 "Property 'title': Expected 'string' but got 'integer'."); | 445 "Property 'title': Expected 'string' but got 'integer'."); |
| 434 | 446 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 "toolstrip.collapse", | 564 "toolstrip.collapse", |
| 553 "\"http://foo/\""); | 565 "\"http://foo/\""); |
| 554 | 566 |
| 555 ExpectJsFail("chrome.toolstrip.collapse(100)", | 567 ExpectJsFail("chrome.toolstrip.collapse(100)", |
| 556 "Uncaught Error: Invalid value for argument 0. " | 568 "Uncaught Error: Invalid value for argument 0. " |
| 557 "Expected 'string' but got 'integer'."); | 569 "Expected 'string' but got 'integer'."); |
| 558 ExpectJsFail("chrome.toolstrip.collapse('http://foo/', 32)", | 570 ExpectJsFail("chrome.toolstrip.collapse('http://foo/', 32)", |
| 559 "Uncaught Error: Invalid value for argument 1. " | 571 "Uncaught Error: Invalid value for argument 1. " |
| 560 "Expected 'function' but got 'integer'."); | 572 "Expected 'function' but got 'integer'."); |
| 561 } | 573 } |
| OLD | NEW |