Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> | 4 <script> |
| 5 var callbackFunctionTest = internals.callbackFunctionTest(); | |
| 6 | |
| 5 test(function() { | 7 test(function() { |
| 6 var callbackFunctionTest = internals.callbackFunctionTest(); | |
| 7 var callback1 = function(msg1, msg2) { | 8 var callback1 = function(msg1, msg2) { |
| 8 return msg1 + ', ' + msg2; | 9 return msg1 + ', ' + msg2; |
| 9 }; | 10 }; |
| 10 assert_equals(callbackFunctionTest.testCallback(callback1, 'hello', 'world') , 'SUCCESS: hello, world'); | 11 assert_equals(callbackFunctionTest.testCallback(callback1, 'hello', 'world') , 'SUCCESS: hello, world'); |
| 11 | 12 |
| 12 var callback2 = function(msg1, msg2) { | 13 var callback2 = function(msg1, msg2) { |
| 13 return msg1 + msg1 + ' ' + msg2 + msg2; | 14 return msg1 + msg1 + ' ' + msg2 + msg2; |
| 14 }; | 15 }; |
| 15 assert_equals(callbackFunctionTest.testCallback(callback2, 'hello', 'world') , 'SUCCESS: hellohello worldworld'); | 16 assert_equals(callbackFunctionTest.testCallback(callback2, 'hello', 'world') , 'SUCCESS: hellohello worldworld'); |
| 16 }, 'Callback function which takes two strings'); | 17 }, 'Callback function which takes two strings'); |
| 18 | |
| 19 test(function() { | |
| 20 var div = [document.createElement('div'), document.createElement('div')]; | |
|
bashi
2016/09/23 02:16:05
nit: You don't have to use an array. Maybe just fo
lkawai
2016/09/23 02:43:41
I defined testInterfaceCallback using array of int
peria
2016/09/23 02:50:05
+1.
Container is an interface, but its elements ar
peria
2016/09/23 02:50:05
Then I recommend to make two separate tests.
One i
bashi
2016/09/23 02:57:56
This lacks simple use though. You should add follo
lkawai
2016/09/23 05:35:44
Done.
| |
| 21 var getDivElement = function(d) { | |
|
peria
2016/09/23 02:50:05
rename this function. it does not meet its behavio
lkawai
2016/09/23 05:35:44
Done.
| |
| 22 d[0].innerHTML = 'hello'; | |
|
bashi
2016/09/23 02:16:05
nit: 4-space indent
lkawai
2016/09/23 02:43:41
Done.
| |
| 23 d[1].innerHTML = 'world'; | |
| 24 }; | |
| 25 callbackFunctionTest.testInterfaceCallback(getDivElement, div); | |
| 26 assert_equals(div[0].innerHTML, 'hello'); | |
| 27 assert_equals(div[1].innerHTML, 'world'); | |
| 28 }, 'Callback function which takes a interface'); | |
| 17 </script> | 29 </script> |
| OLD | NEW |