Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: chrome/renderer/extensions/extension_api_client_unittest.cc

Issue 160276: mole expand/collapse API (Closed)
Patch Set: fixed a couple of crashers Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/toolstrip.html ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_api_client_unittest.cc
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index bd0ce092ba94523083260b780c9b403ca9799092..5465a5ce710d4385fce9284b318a8cbcc09c322a 100644
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -518,3 +518,44 @@ TEST_F(ExtensionAPIClientTest, EnablePageAction) {
"pageActions.disableForTab",
"[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]");
}
+
+TEST_F(ExtensionAPIClientTest, ExpandToolstrip) {
+ ExpectJsPass("chrome.toolstrip.expand(100, 'http://foo/')",
+ "toolstrip.expand",
+ "[100,\"http://foo/\"]");
+ ExpectJsPass("chrome.toolstrip.expand(100, null)",
+ "toolstrip.expand",
+ "[100,null]");
+ ExpectJsPass("chrome.toolstrip.expand(100, 'http://foo/', function(){})",
+ "toolstrip.expand",
+ "[100,\"http://foo/\"]");
+
+ ExpectJsFail("chrome.toolstrip.expand('100', 'http://foo/')",
+ "Uncaught Error: Invalid value for argument 0. "
+ "Expected 'integer' but got 'string'.");
+ ExpectJsFail("chrome.toolstrip.expand(100, 100)",
+ "Uncaught Error: Invalid value for argument 1. "
+ "Expected 'string' but got 'integer'.");
+ ExpectJsFail("chrome.toolstrip.expand(100, 'http://foo/', 32)",
+ "Uncaught Error: Invalid value for argument 2. "
+ "Expected 'function' but got 'integer'.");
+}
+
+TEST_F(ExtensionAPIClientTest, CollapseToolstrip) {
+ ExpectJsPass("chrome.toolstrip.collapse('http://foo/')",
+ "toolstrip.collapse",
+ "\"http://foo/\"");
+ ExpectJsPass("chrome.toolstrip.collapse(null)",
+ "toolstrip.collapse",
+ "null");
+ ExpectJsPass("chrome.toolstrip.collapse('http://foo/', function(){})",
+ "toolstrip.collapse",
+ "\"http://foo/\"");
+
+ ExpectJsFail("chrome.toolstrip.collapse(100)",
+ "Uncaught Error: Invalid value for argument 0. "
+ "Expected 'string' but got 'integer'.");
+ ExpectJsFail("chrome.toolstrip.collapse('http://foo/', 32)",
+ "Uncaught Error: Invalid value for argument 1. "
+ "Expected 'function' but got 'integer'.");
+}
« no previous file with comments | « chrome/common/extensions/docs/toolstrip.html ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698