Chromium Code Reviews| Index: chrome/test/data/webui/async_gen.js |
| diff --git a/chrome/test/data/webui/async_gen.js b/chrome/test/data/webui/async_gen.js |
| index bf2977242cba46ae45f655e8b6d5f89615c87610..0421ee86bd2ab4abb7d9367429bbb8cbbf6d61d5 100644 |
| --- a/chrome/test/data/webui/async_gen.js |
| +++ b/chrome/test/data/webui/async_gen.js |
| @@ -101,21 +101,11 @@ TEST_F('WebUIBrowserAsyncGenTest', 'TestContinue', function() { |
| // Test that runAllActionsAsync can be called with multiple functions, and with |
| // bound, saved, or mixed arguments. |
| TEST_F('WebUIBrowserAsyncGenTest', 'TestRunAllActionsAsyncMock', function() { |
| - /** |
| - * Create a handler class with empty methods to allow mocking to register |
| - * expectations and for registration of handlers with chrome.send. |
| - * @constructor |
| - */ |
| - function MockHandler() {} |
| - |
| - MockHandler.prototype = { |
| - testBoundArgs: function() {}, |
| - testSavedArgs: function() {}, |
| - testMixedArgs: function() {}, |
| - }; |
| - |
| - var mockHandler = mock(MockHandler); |
| - registerMockMessageCallbacks(mockHandler, MockHandler); |
| + this.makeAndRegisterMockHandler(['testBoundArgs', |
| + 'testSavedArgs', |
| + 'testMixedArgs', |
| + ]); |
| + var mockHandler = this.mockHandler; |
| // Bind some arguments. |
| var var1, var2; |
| @@ -198,19 +188,10 @@ function setTestRanTrue() { |
| // Test overriding globals. |
| TEST_F('WebUIBrowserAsyncGenTest', 'TestRegisterMockGlobals', function() { |
| - /** |
| - * Create a mock class to describe the globals to mock. |
| - * @constructor |
| - */ |
| - function MockGlobals() {} |
| - |
| - MockGlobals.prototype = { |
| - setTestRanTrue: function() {}, |
| - }; |
| + this.makeAndRegisterMockGlobals(['setTestRanTrue']); |
| // Mock the setTestRanTrue global function. |
| - var mockGlobals = mock(MockGlobals); |
| - registerMockGlobals(mockGlobals, MockGlobals); |
| + var mockGlobals = this.mockGlobals; |
| mockGlobals.expects(once()).setTestRanTrue(). |
| will(runAllActionsAsync( |
| WhenTestDone.ALWAYS, |
| @@ -288,19 +269,8 @@ WebUIBrowserAsyncGenDeferredToGlobalTest.prototype = { |
| /** @inheritDoc */ |
| setUp: function() { |
| - /** |
| - * Create a mock class to describe the globals to mock. |
| - * @constructor |
| - */ |
| - function MockGlobals() {} |
| - |
| - MockGlobals.prototype = { |
| - setTestRanTrue: function() {}, |
| - }; |
| - |
| - // Mock the setTestRanTrue global function. |
| - var mockGlobals = mock(MockGlobals); |
| - registerMockGlobals(mockGlobals, MockGlobals); |
| + this.makeAndRegisterMockGlobals(['setTestRanTrue']); |
| + var mockGlobals = this.mockGlobals; |
|
James Hawkins
2011/11/09 17:15:56
Why are you using both this.mockGlobals and local
James Hawkins
2011/11/10 00:24:43
Is there a reason you keep ignoring this question?
Sheridan Rawlins
2011/11/10 02:02:12
no & done.
|
| mockGlobals.expects(once()).setTestRanTrue(). |
| will(runAllActionsAsync( |
| WhenTestDone.ALWAYS, |