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

Side by Side Diff: chrome/browser/resources/google_now/utility_unittest.gtestjs

Issue 24924002: Switching getting/dismissing cards to new protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More rgustafson's comments Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/google_now/utility.js ('k') | chrome/test/data/webui/test_api.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Test fixture for utility.js. 6 * Test fixture for utility.js.
7 * @constructor 7 * @constructor
8 * @extends {testing.Test} 8 * @extends {testing.Test}
9 */ 9 */
10 function GoogleNowUtilityUnitTest () { 10 function GoogleNowUtilityUnitTest () {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 trace: 'Error: TEST ERROR MESSAGE\n ' + 53 trace: 'Error: TEST ERROR MESSAGE\n ' +
54 'at buildErrorWithMessageForServer (chrome-extension://ext_id/util' + 54 'at buildErrorWithMessageForServer (chrome-extension://ext_id/util' +
55 'ity.js:29:15)\n ' + 55 'ity.js:29:15)\n ' +
56 'at <anonymous>:2:16\n ' + 56 'at <anonymous>:2:16\n ' +
57 'at Object.InjectedScript._evaluateOn (<anonymous>:580:39)\n ' + 57 'at Object.InjectedScript._evaluateOn (<anonymous>:580:39)\n ' +
58 'at Object.InjectedScript._evaluateAndWrap (<anonymous>:539:52)\n' + 58 'at Object.InjectedScript._evaluateAndWrap (<anonymous>:539:52)\n' +
59 ' at Object.InjectedScript.evaluate (<anonymous>:458:21)' 59 ' at Object.InjectedScript.evaluate (<anonymous>:458:21)'
60 }; 60 };
61 61
62 this.mockGlobals.expects(once()). 62 this.mockGlobals.expects(once()).
63 buildServerRequest('jserrors', 'application/json'). 63 buildServerRequest('POST', 'jserrors', 'application/json').
64 will(returnValue(mockRequest)); 64 will(returnValue(mockRequest));
65 this.mockLocalFunctions.expects(once()).sendRequest( 65 this.mockLocalFunctions.expects(once()).sendRequest(
66 JSON.stringify(expectedRequestObject)); 66 JSON.stringify(expectedRequestObject));
67 67
68 // Invoking the tested function. 68 // Invoking the tested function.
69 sendErrorReport(testError); 69 sendErrorReport(testError);
70 }); 70 });
71 71
72 TEST_F('GoogleNowUtilityUnitTest', 'SendErrorReport2', function() { 72 TEST_F('GoogleNowUtilityUnitTest', 'SendErrorReport2', function() {
73 // Test sending report for an error with a message that should not be sent to 73 // Test sending report for an error with a message that should not be sent to
(...skipping 18 matching lines...) Expand all
92 var expectedRequestObject = { 92 var expectedRequestObject = {
93 message: 'TypeError', 93 message: 'TypeError',
94 file: '//ext_id/background.js', 94 file: '//ext_id/background.js',
95 line: '444', 95 line: '444',
96 trace: '(message removed)\n ' + 96 trace: '(message removed)\n ' +
97 'at chrome-extension://ext_id/background.js:444:11\n ' + 97 'at chrome-extension://ext_id/background.js:444:11\n ' +
98 'at chrome-extension://ext_id/utility.js:509:7' 98 'at chrome-extension://ext_id/utility.js:509:7'
99 }; 99 };
100 100
101 this.mockGlobals.expects(once()). 101 this.mockGlobals.expects(once()).
102 buildServerRequest('jserrors', 'application/json'). 102 buildServerRequest('POST', 'jserrors', 'application/json').
103 will(returnValue(mockRequest)); 103 will(returnValue(mockRequest));
104 this.mockLocalFunctions.expects(once()).sendRequest( 104 this.mockLocalFunctions.expects(once()).sendRequest(
105 JSON.stringify(expectedRequestObject)); 105 JSON.stringify(expectedRequestObject));
106 106
107 // Invoking the tested function. 107 // Invoking the tested function.
108 sendErrorReport(testError); 108 sendErrorReport(testError);
109 }); 109 });
110 110
111 TEST_F('GoogleNowUtilityUnitTest', 'WrapperCheckInWrappedCallback', function() { 111 TEST_F('GoogleNowUtilityUnitTest', 'WrapperCheckInWrappedCallback', function() {
112 // Test generating an error when calling wrapper.checkInWrappedCallback from a 112 // Test generating an error when calling wrapper.checkInWrappedCallback from a
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 var alarmsGetSavedArgs = new SaveMockArguments(); 930 var alarmsGetSavedArgs = new SaveMockArguments();
931 this.mockApis.expects(once()). 931 this.mockApis.expects(once()).
932 instrumented_alarms_get( 932 instrumented_alarms_get(
933 alarmsGetSavedArgs.match(eq(testAttemptAlarmName)), 933 alarmsGetSavedArgs.match(eq(testAttemptAlarmName)),
934 alarmsGetSavedArgs.match(ANYTHING)). 934 alarmsGetSavedArgs.match(ANYTHING)).
935 will(invokeCallback(alarmsGetSavedArgs, 1, {testField: 'TEST VALUE'})); 935 will(invokeCallback(alarmsGetSavedArgs, 1, {testField: 'TEST VALUE'}));
936 this.mockLocalFunctions.expects(once()).attempt(); 936 this.mockLocalFunctions.expects(once()).attempt();
937 // Invocation. 937 // Invocation.
938 onAlarmHandlerContainer[0]({name: testAttemptAlarmName}); 938 onAlarmHandlerContainer[0]({name: testAttemptAlarmName});
939 }); 939 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/google_now/utility.js ('k') | chrome/test/data/webui/test_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698