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