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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 "pageActions.enableForTab", | 511 "pageActions.enableForTab", |
512 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," | 512 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," |
513 "\"title\":\"a\",\"iconId\":0}]"); | 513 "\"title\":\"a\",\"iconId\":0}]"); |
514 | 514 |
515 // Now try disablePageAction. | 515 // Now try disablePageAction. |
516 ExpectJsPass("chrome.pageActions.disableForTab(" | 516 ExpectJsPass("chrome.pageActions.disableForTab(" |
517 "'dummy', {tabId: 0, url: 'http://foo/'});", | 517 "'dummy', {tabId: 0, url: 'http://foo/'});", |
518 "pageActions.disableForTab", | 518 "pageActions.disableForTab", |
519 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); | 519 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); |
520 } | 520 } |
| 521 |
| 522 TEST_F(ExtensionAPIClientTest, ExpandToolstrip) { |
| 523 ExpectJsPass("chrome.toolstrip.expand(100, 'http://foo/')", |
| 524 "toolstrip.expand", |
| 525 "[100,\"http://foo/\"]"); |
| 526 ExpectJsPass("chrome.toolstrip.expand(100, null)", |
| 527 "toolstrip.expand", |
| 528 "[100,null]"); |
| 529 ExpectJsPass("chrome.toolstrip.expand(100, 'http://foo/', function(){})", |
| 530 "toolstrip.expand", |
| 531 "[100,\"http://foo/\"]"); |
| 532 |
| 533 ExpectJsFail("chrome.toolstrip.expand('100', 'http://foo/')", |
| 534 "Uncaught Error: Invalid value for argument 0. " |
| 535 "Expected 'integer' but got 'string'."); |
| 536 ExpectJsFail("chrome.toolstrip.expand(100, 100)", |
| 537 "Uncaught Error: Invalid value for argument 1. " |
| 538 "Expected 'string' but got 'integer'."); |
| 539 ExpectJsFail("chrome.toolstrip.expand(100, 'http://foo/', 32)", |
| 540 "Uncaught Error: Invalid value for argument 2. " |
| 541 "Expected 'function' but got 'integer'."); |
| 542 } |
| 543 |
| 544 TEST_F(ExtensionAPIClientTest, CollapseToolstrip) { |
| 545 ExpectJsPass("chrome.toolstrip.collapse('http://foo/')", |
| 546 "toolstrip.collapse", |
| 547 "\"http://foo/\""); |
| 548 ExpectJsPass("chrome.toolstrip.collapse(null)", |
| 549 "toolstrip.collapse", |
| 550 "null"); |
| 551 ExpectJsPass("chrome.toolstrip.collapse('http://foo/', function(){})", |
| 552 "toolstrip.collapse", |
| 553 "\"http://foo/\""); |
| 554 |
| 555 ExpectJsFail("chrome.toolstrip.collapse(100)", |
| 556 "Uncaught Error: Invalid value for argument 0. " |
| 557 "Expected 'string' but got 'integer'."); |
| 558 ExpectJsFail("chrome.toolstrip.collapse('http://foo/', 32)", |
| 559 "Uncaught Error: Invalid value for argument 1. " |
| 560 "Expected 'function' but got 'integer'."); |
| 561 } |
OLD | NEW |