| 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/json_reader.h" | 6 #include "base/json/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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 "Expected 'integer' but got 'string'."); | 283 "Expected 'integer' but got 'string'."); |
| 284 | 284 |
| 285 ExpectJsFail("chrome.tabs.get(1, 1);", | 285 ExpectJsFail("chrome.tabs.get(1, 1);", |
| 286 "Uncaught Error: Invalid value for argument 1. " | 286 "Uncaught Error: Invalid value for argument 1. " |
| 287 "Expected 'function' but got 'integer'."); | 287 "Expected 'function' but got 'integer'."); |
| 288 | 288 |
| 289 ExpectJsPass("chrome.tabs.get(2, function(){})", | 289 ExpectJsPass("chrome.tabs.get(2, function(){})", |
| 290 "tabs.get", "2"); | 290 "tabs.get", "2"); |
| 291 } | 291 } |
| 292 | 292 |
| 293 #if defined(OS_WIN) | |
| 294 TEST_F(ExtensionAPIClientTest, DetectTabLanguage) { | 293 TEST_F(ExtensionAPIClientTest, DetectTabLanguage) { |
| 295 ExpectJsFail("chrome.tabs.detectLanguage(32, function(){}, 20);", | 294 ExpectJsFail("chrome.tabs.detectLanguage(32, function(){}, 20);", |
| 296 "Uncaught Error: Too many arguments."); | 295 "Uncaught Error: Too many arguments."); |
| 297 | 296 |
| 298 ExpectJsFail("chrome.tabs.detectLanguage('abc', function(){});", | 297 ExpectJsFail("chrome.tabs.detectLanguage('abc', function(){});", |
| 299 "Uncaught Error: Invalid value for argument 0. " | 298 "Uncaught Error: Invalid value for argument 0. " |
| 300 "Expected 'integer' but got 'string'."); | 299 "Expected 'integer' but got 'string'."); |
| 301 | 300 |
| 302 ExpectJsFail("chrome.tabs.detectLanguage(1, 1);", | 301 ExpectJsFail("chrome.tabs.detectLanguage(1, 1);", |
| 303 "Uncaught Error: Invalid value for argument 1. " | 302 "Uncaught Error: Invalid value for argument 1. " |
| 304 "Expected 'function' but got 'integer'."); | 303 "Expected 'function' but got 'integer'."); |
| 305 | 304 |
| 306 ExpectJsPass("chrome.tabs.detectLanguage(null, function(){})", | 305 ExpectJsPass("chrome.tabs.detectLanguage(null, function(){})", |
| 307 "tabs.detectLanguage", "null"); | 306 "tabs.detectLanguage", "null"); |
| 308 } | 307 } |
| 309 #endif | |
| 310 | 308 |
| 311 TEST_F(ExtensionAPIClientTest, GetSelectedTab) { | 309 TEST_F(ExtensionAPIClientTest, GetSelectedTab) { |
| 312 ExpectJsFail("chrome.tabs.getSelected(32, function(){}, 20);", | 310 ExpectJsFail("chrome.tabs.getSelected(32, function(){}, 20);", |
| 313 "Uncaught Error: Too many arguments."); | 311 "Uncaught Error: Too many arguments."); |
| 314 | 312 |
| 315 ExpectJsFail("chrome.tabs.getSelected(32);", | 313 ExpectJsFail("chrome.tabs.getSelected(32);", |
| 316 "Uncaught Error: Parameter 1 is required."); | 314 "Uncaught Error: Parameter 1 is required."); |
| 317 | 315 |
| 318 ExpectJsFail("chrome.tabs.getSelected('abc', function(){});", | 316 ExpectJsFail("chrome.tabs.getSelected('abc', function(){});", |
| 319 "Uncaught Error: Invalid value for argument 0. " | 317 "Uncaught Error: Invalid value for argument 0. " |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 630 |
| 633 ExpectJsFail("chrome.i18n.getMessage('name', [])", | 631 ExpectJsFail("chrome.i18n.getMessage('name', [])", |
| 634 "Uncaught Error: Invalid value for argument 1. Value does not " | 632 "Uncaught Error: Invalid value for argument 1. Value does not " |
| 635 "match any valid type choices."); | 633 "match any valid type choices."); |
| 636 | 634 |
| 637 ExpectJsFail("chrome.i18n.getMessage('name', ['p1', 'p2', 'p3', 'p4', 'p5', " | 635 ExpectJsFail("chrome.i18n.getMessage('name', ['p1', 'p2', 'p3', 'p4', 'p5', " |
| 638 "'p6', 'p7', 'p8', 'p9', 'p10'])", | 636 "'p6', 'p7', 'p8', 'p9', 'p10'])", |
| 639 "Uncaught Error: Invalid value for argument 1. Value does not " | 637 "Uncaught Error: Invalid value for argument 1. Value does not " |
| 640 "match any valid type choices."); | 638 "match any valid type choices."); |
| 641 } | 639 } |
| OLD | NEW |