Index: chrome/test/data/webui/cr_test.html |
diff --git a/chrome/test/data/webui/cr_test.html b/chrome/test/data/webui/cr_test.html |
index b592cac18ffba3e36ef4bf32cd5ff315bf8d74d1..b1ec46ed393346fdeaae9d74e1cd24f5731c9c65 100644 |
--- a/chrome/test/data/webui/cr_test.html |
+++ b/chrome/test/data/webui/cr_test.html |
@@ -243,8 +243,8 @@ function testAddSingletonGetter() { |
assertEquals('object', typeof z, 'Should work after clearing for testing'); |
assertNotEqual(null, z, 'Created object should not be null'); |
- assertNotEqual(x, z, |
- 'Should return a different object after clearing for testing'); |
+ assertNotEqual( |
+ x, z, 'Should return a different object after clearing for testing'); |
Dan Beam
2016/01/23 02:48:51
nit: revert
dpapad
2016/01/25 18:34:22
Reverting, but previous version violates styleguid
Dan Beam
2016/01/25 18:48:37
nah, it doesn't
https://engdoc.corp.google.com/en
|
} |
function testDefineWithGetter() { |
@@ -264,70 +264,7 @@ function testDefineWithGetter() { |
} |
/** |
- * Executes a function given a potentially namespaced function name, e.g., |
- * cr.webUIListenerCallback. |
- * @param {string} functionName The name of the function, including any |
- * namespaces, to execute. |
- */ |
-function executeFunctionByName(functionName) { |
- var args = Array.prototype.slice.call(arguments, 1); |
- var func = (0, eval)(functionName); |
- func.apply(undefined, args); |
-} |
- |
-/** |
- * Tests that cr.sendWithCallback correctly handles the case where the JS sends |
- * no arguments to the WebUI handler. |
- */ |
-function testSendWithCallback_PassesJSArgs() { |
dpapad
2016/01/22 23:03:22
Interesting fact. Both this function and following
|
- var testMethodName = 'getFullscreenState'; |
- |
- // Mock out chrome.send to emulate a WebUI handler calling back with the |
- // result of a getFullscreenState call. |
- window.chrome = {}; |
- window.chrome.send = function(method, args) { |
- assertEquals(testMethodName, method); |
- var callbackName = args[0]; |
- var id = args[1]; |
- executeFunctionByName(callbackName, id, /* fullscreen */ true); |
- }; |
- |
- var callbackResponse; |
- cr.sendWithCallback(testMethodName, undefined, function(fullscreen) { |
- callbackResponse = fullscreen; |
- }); |
- |
- assertTrue(callbackResponse); |
-} |
- |
-/** |
- * Tests that cr.sendWithCallback passes arguments from JS to the WebUI |
- * handler. |
- */ |
-function testSendWithCallback_PassesJSArgs() { |
- var testMethodName = 'getSquareOfX'; |
- |
- // Mock out chrome.send to emulate a WebUI handler calling back with the |
- // result of a getSquareOfX call. |
- window.chrome = {}; |
- window.chrome.send = function(method, args) { |
- assertEquals(testMethodName, method); |
- var callbackName = args[0]; |
- var id = args[1]; |
- var x = args[2]; |
- executeFunctionByName(callbackName, id, x * x); |
- }; |
- |
- var callbackResponse; |
- cr.sendWithCallback(testMethodName, [5], function(square) { |
- callbackResponse = square; |
- }); |
- |
- assertEquals(25, callbackResponse); |
-} |
- |
-/** |
- * Tests that an event fired by a WebUI handler is sent to all listeners. |
+ * Tests that an event fired by a WebUI handler is sent to all listeners. |
*/ |
function testAddWebUIListener() { |
var responses = new Map(); |
@@ -338,8 +275,7 @@ function testAddWebUIListener() { |
responses.set('second', enabled); |
}); |
- executeFunctionByName( |
- 'cr.webUIListenerCallback', 'fullscreen-enabled', true); |
+ window['cr']['webUIListenerCallback']('fullscreen-enabled', true); |
Dan Beam
2016/01/23 02:48:51
we don't do renaming, also why can't this just be
dpapad
2016/01/25 18:34:22
Done. No good reason (I was just trying to remove
|
assertTrue(responses.get('first')); |
assertTrue(responses.get('second')); |