| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 "Expected 'integer' but got 'string'."); | 268 "Expected 'integer' but got 'string'."); |
| 269 | 269 |
| 270 ExpectJsFail("chrome.tabs.get(1, 1);", | 270 ExpectJsFail("chrome.tabs.get(1, 1);", |
| 271 "Uncaught Error: Invalid value for argument 1. " | 271 "Uncaught Error: Invalid value for argument 1. " |
| 272 "Expected 'function' but got 'integer'."); | 272 "Expected 'function' but got 'integer'."); |
| 273 | 273 |
| 274 ExpectJsPass("chrome.tabs.get(2, function(){})", | 274 ExpectJsPass("chrome.tabs.get(2, function(){})", |
| 275 "GetTab", "2"); | 275 "GetTab", "2"); |
| 276 } | 276 } |
| 277 | 277 |
| 278 #if defined(OS_WIN) |
| 279 TEST_F(ExtensionAPIClientTest, GetTabLanguage) { |
| 280 ExpectJsFail("chrome.tabs.getLanguage(32, function(){}, 20);", |
| 281 "Uncaught Error: Too many arguments."); |
| 282 |
| 283 ExpectJsFail("chrome.tabs.getLanguage('abc', function(){});", |
| 284 "Uncaught Error: Invalid value for argument 0. " |
| 285 "Expected 'integer' but got 'string'."); |
| 286 |
| 287 ExpectJsFail("chrome.tabs.getLanguage(1, 1);", |
| 288 "Uncaught Error: Invalid value for argument 1. " |
| 289 "Expected 'function' but got 'integer'."); |
| 290 |
| 291 ExpectJsPass("chrome.tabs.getLanguage(null, function(){})", |
| 292 "GetTabLanguage", "null"); |
| 293 } |
| 294 #endif |
| 295 |
| 278 TEST_F(ExtensionAPIClientTest, GetSelectedTab) { | 296 TEST_F(ExtensionAPIClientTest, GetSelectedTab) { |
| 279 ExpectJsFail("chrome.tabs.getSelected(32, function(){}, 20);", | 297 ExpectJsFail("chrome.tabs.getSelected(32, function(){}, 20);", |
| 280 "Uncaught Error: Too many arguments."); | 298 "Uncaught Error: Too many arguments."); |
| 281 | 299 |
| 282 ExpectJsFail("chrome.tabs.getSelected(32);", | 300 ExpectJsFail("chrome.tabs.getSelected(32);", |
| 283 "Uncaught Error: Parameter 1 is required."); | 301 "Uncaught Error: Parameter 1 is required."); |
| 284 | 302 |
| 285 ExpectJsFail("chrome.tabs.getSelected('abc', function(){});", | 303 ExpectJsFail("chrome.tabs.getSelected('abc', function(){});", |
| 286 "Uncaught Error: Invalid value for argument 0. " | 304 "Uncaught Error: Invalid value for argument 0. " |
| 287 "Expected 'integer' but got 'string'."); | 305 "Expected 'integer' but got 'string'."); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 "EnablePageAction", | 511 "EnablePageAction", |
| 494 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," | 512 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"," |
| 495 "\"title\":\"a\",\"iconId\":0}]"); | 513 "\"title\":\"a\",\"iconId\":0}]"); |
| 496 | 514 |
| 497 // Now try disablePageAction. | 515 // Now try disablePageAction. |
| 498 ExpectJsPass("chrome.pageActions.disableForTab(" | 516 ExpectJsPass("chrome.pageActions.disableForTab(" |
| 499 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", | 517 "\"dummy\", {tabId: 0, url: \"http://foo/\"});", |
| 500 "DisablePageAction", | 518 "DisablePageAction", |
| 501 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); | 519 "[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]"); |
| 502 } | 520 } |
| OLD | NEW |