OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Mocks for globals needed for loading background.js. | 5 // Mocks for globals needed for loading background.js. |
6 | 6 |
7 function emptyMock() {} | |
8 | |
9 var wrapper = {instrumentChromeApiFunction: emptyMock}; | 7 var wrapper = {instrumentChromeApiFunction: emptyMock}; |
10 | 8 |
11 function buildTaskManager() { | 9 function buildTaskManager() { |
12 return {debugSetStepName: emptyMock}; | 10 return {debugSetStepName: emptyMock}; |
13 } | 11 } |
14 | 12 |
15 function buildAuthenticationManager() { | 13 function buildAuthenticationManager() { |
16 return { | 14 return { |
17 addListener: emptyMock | 15 addListener: emptyMock |
18 }; | 16 }; |
19 } | 17 } |
20 | 18 |
21 var instrumentApiFunction = emptyMock; | 19 var instrumentApiFunction = emptyMock; |
22 var buildAttemptManager = emptyMock; | 20 var buildAttemptManager = emptyMock; |
23 var buildCardSet = emptyMock; | 21 var buildCardSet = emptyMock; |
24 var emptyListener = {addListener: emptyMock}; | 22 |
25 var instrumented = {}; | 23 var instrumented = {}; |
26 instrumented['location'] = {onLocationUpdate: emptyListener}; | 24 mockChromeEvent(instrumented, 'location.onLocationUpdate'); |
27 instrumented['notifications'] = { | 25 mockChromeEvent(instrumented, 'notifications.onButtonClicked'); |
28 onButtonClicked: emptyListener, | 26 mockChromeEvent(instrumented, 'notifications.onClicked'); |
29 onClicked: emptyListener, | 27 mockChromeEvent(instrumented, 'notifications.onClosed'); |
30 onClosed: emptyListener | 28 mockChromeEvent(instrumented, 'omnibox.onInputEntered'); |
31 }; | 29 mockChromeEvent( |
32 instrumented['omnibox'] = {onInputEntered: emptyListener}; | 30 instrumented, 'preferencesPrivate.googleGeolocationAccessEnabled.onChange'); |
33 instrumented['preferencesPrivate'] = { | 31 mockChromeEvent(instrumented, 'runtime.onInstalled'); |
34 googleGeolocationAccessEnabled: { | 32 mockChromeEvent(instrumented, 'runtime.onStartup'); |
35 onChange: emptyListener | |
36 } | |
37 }; | |
38 instrumented['runtime'] = { | |
39 onInstalled: emptyListener, | |
40 onStartup: emptyListener | |
41 }; | |
OLD | NEW |