Chromium Code Reviews| 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/json_reader.h" | 6 #include "base/json_reader.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 "\"index\":2," | 376 "\"index\":2," |
| 377 "\"windowId\":4}"); | 377 "\"windowId\":4}"); |
| 378 } | 378 } |
| 379 | 379 |
| 380 TEST_F(ExtensionAPIClientTest, UpdateTab) { | 380 TEST_F(ExtensionAPIClientTest, UpdateTab) { |
| 381 ExpectJsFail("chrome.tabs.update(null);", | 381 ExpectJsFail("chrome.tabs.update(null);", |
| 382 "Uncaught Error: Parameter 0 is required."); | 382 "Uncaught Error: Parameter 0 is required."); |
| 383 ExpectJsFail("chrome.tabs.update(42, {selected: 'foo'});", | 383 ExpectJsFail("chrome.tabs.update(42, {selected: 'foo'});", |
| 384 "Uncaught Error: Invalid value for argument 1. Property " | 384 "Uncaught Error: Invalid value for argument 1. Property " |
| 385 "'selected': Expected 'boolean' but got 'string'."); | 385 "'selected': Expected 'boolean' but got 'string'."); |
| 386 ExpectJsFail("chrome.tabs.update(42, {pinned: 'foo'});", | |
|
Aaron Boodman
2010/10/14 18:04:17
We don't really use this class anymore. We should
| |
| 387 "Uncaught Error: Invalid value for argument 1. Property " | |
| 388 "'pinned': Expected 'boolean' but got 'string'."); | |
| 386 ExpectJsFail("chrome.tabs.update(42, {url: 42});", | 389 ExpectJsFail("chrome.tabs.update(42, {url: 42});", |
| 387 "Uncaught Error: Invalid value for argument 1. Property " | 390 "Uncaught Error: Invalid value for argument 1. Property " |
| 388 "'url': Expected 'string' but got 'integer'."); | 391 "'url': Expected 'string' but got 'integer'."); |
| 389 | 392 |
| 390 ExpectJsPass("chrome.tabs.update(42, {" | 393 ExpectJsPass("chrome.tabs.update(42, {" |
| 391 " url:'http://www.google.com/'," | 394 " url:'http://www.google.com/'," |
| 392 " selected:true" | 395 " selected:true," |
| 396 " pinned:false" | |
| 393 "})", | 397 "})", |
| 394 "tabs.update", | 398 "tabs.update", |
| 395 "[42," | 399 "[42," |
| 396 "{\"url\":\"http://www.google.com/\"," | 400 "{\"url\":\"http://www.google.com/\"," |
| 397 "\"selected\":true}]"); | 401 "\"selected\":true,\"pinned\":false}]"); |
| 398 } | 402 } |
| 399 | 403 |
| 400 TEST_F(ExtensionAPIClientTest, MoveTab) { | 404 TEST_F(ExtensionAPIClientTest, MoveTab) { |
| 401 ExpectJsFail("chrome.tabs.move(null);", | 405 ExpectJsFail("chrome.tabs.move(null);", |
| 402 "Uncaught Error: Parameter 0 is required."); | 406 "Uncaught Error: Parameter 0 is required."); |
| 403 ExpectJsFail("chrome.tabs.move(42, {index: 'foo'});", | 407 ExpectJsFail("chrome.tabs.move(42, {index: 'foo'});", |
| 404 "Uncaught Error: Invalid value for argument 1. Property " | 408 "Uncaught Error: Invalid value for argument 1. Property " |
| 405 "'index': Expected 'integer' but got 'string'."); | 409 "'index': Expected 'integer' but got 'string'."); |
| 406 ExpectJsFail("chrome.tabs.move(42, {index: 3, windowId: 'foo'});", | 410 ExpectJsFail("chrome.tabs.move(42, {index: 3, windowId: 'foo'});", |
| 407 "Uncaught Error: Invalid value for argument 1. Property " | 411 "Uncaught Error: Invalid value for argument 1. Property " |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 | 628 |
| 625 ExpectJsFail("chrome.i18n.getMessage('name', [])", | 629 ExpectJsFail("chrome.i18n.getMessage('name', [])", |
| 626 "Uncaught Error: Invalid value for argument 1. Value does not " | 630 "Uncaught Error: Invalid value for argument 1. Value does not " |
| 627 "match any valid type choices."); | 631 "match any valid type choices."); |
| 628 | 632 |
| 629 ExpectJsFail("chrome.i18n.getMessage('name', ['p1', 'p2', 'p3', 'p4', 'p5', " | 633 ExpectJsFail("chrome.i18n.getMessage('name', ['p1', 'p2', 'p3', 'p4', 'p5', " |
| 630 "'p6', 'p7', 'p8', 'p9', 'p10'])", | 634 "'p6', 'p7', 'p8', 'p9', 'p10'])", |
| 631 "Uncaught Error: Invalid value for argument 1. Value does not " | 635 "Uncaught Error: Invalid value for argument 1. Value does not " |
| 632 "match any valid type choices."); | 636 "match any valid type choices."); |
| 633 } | 637 } |
| OLD | NEW |