summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/extension_api_client_unittest.cc
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 14:59:32 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 14:59:32 +0000
commitc6619189d9d7176f62754fce548cdcedf8831bcf (patch)
treebfec95efed25eadfa1bd3e4f09e9cda686e09cc0 /chrome/renderer/extensions/extension_api_client_unittest.cc
parentc07e97c914b3defcbf02445a650f01aa57ec04aa (diff)
downloadchromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.zip
chromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.tar.gz
chromium_src-c6619189d9d7176f62754fce548cdcedf8831bcf.tar.bz2
FormatErrorMessage() functions are now publicly available from ExtensionErrorUtils.
ExtensionTabsModule implements a bunch of error_messages. Extension Calls now always deliver a response to the calling context and route error messages if any to the window.console.error log. Review URL: http://codereview.chromium.org/113105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/extension_api_client_unittest.cc')
-rw-r--r--chrome/renderer/extensions/extension_api_client_unittest.cc34
1 files changed, 24 insertions, 10 deletions
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 7e786b7..6104bab 100644
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -91,8 +91,9 @@ TEST_F(ExtensionAPIClientTest, CallbackDispatching) {
ASSERT_TRUE(callback_id >= 0);
// Now send the callback a response
- ExtensionProcessBindings::ExecuteCallbackInFrame(
- GetMainFrame(), callback_id, "{\"foo\":\"bar\"}");
+ ExtensionProcessBindings::CallContext call(GetMainFrame(), "CreateTab");
+ ExtensionProcessBindings::ExecuteResponseInFrame(
+ &call, callback_id, true, "{\"foo\":\"bar\"}", "");
// And verify that it worked
ASSERT_EQ("pass", GetConsoleMessage());
@@ -138,19 +139,19 @@ TEST_F(ExtensionAPIClientTest, GetCurentWindow) {
"GetCurrentWindow", "null");
}
-TEST_F(ExtensionAPIClientTest, GetFocusedWindow) {
- ExpectJsFail("chrome.windows.getFocused(function(){}, 20);",
+TEST_F(ExtensionAPIClientTest, GetLastFocusedWindow) {
+ ExpectJsFail("chrome.windows.getLastFocused(function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chrome.windows.getFocused();",
+ ExpectJsFail("chrome.windows.getLastFocused();",
"Uncaught Error: Parameter 0 is required.");
- ExpectJsFail("chrome.windows.getFocused('abc');",
+ ExpectJsFail("chrome.windows.getLastFocused('abc');",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'function' but got 'string'.");
- ExpectJsPass("chrome.windows.getFocused(function(){})",
- "GetFocusedWindow", "null");
+ ExpectJsPass("chrome.windows.getLastFocused(function(){})",
+ "GetLastFocusedWindow", "null");
}
TEST_F(ExtensionAPIClientTest, GetAllWindows) {
@@ -302,10 +303,23 @@ TEST_F(ExtensionAPIClientTest, MoveTab) {
}
TEST_F(ExtensionAPIClientTest, RemoveTab) {
- ExpectJsFail("chrome.tabs.remove('foobar', function(){});",
+ ExpectJsFail("chrome.tabs.remove(32, function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsPass("chrome.tabs.remove(21)", "RemoveTab", "21");
+
+ ExpectJsFail("chrome.tabs.remove('abc', function(){});",
+ "Uncaught Error: Invalid value for argument 0. "
+ "Expected 'integer' but got 'string'.");
+
+ ExpectJsFail("chrome.tabs.remove(1, 1);",
+ "Uncaught Error: Invalid value for argument 1. "
+ "Expected 'function' but got 'integer'.");
+
+ ExpectJsPass("chrome.tabs.remove(2, function(){})",
+ "RemoveTab", "2");
+
+ ExpectJsPass("chrome.tabs.remove(2)",
+ "RemoveTab", "2");
}
// Bookmark API tests