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

Side by Side Diff: chrome/installer/gcapi/gcapi_test.cc

Issue 18490: Adds the 6-month flag functionality back into the criteria checker,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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/installer/gcapi/gcapi.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/installer/gcapi/gcapi.h" 5 #include "chrome/installer/gcapi/gcapi.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 void call_statically() { 9 void call_statically() {
10 DWORD reason = 0; 10 DWORD reason = 0;
11 BOOL result = FALSE; 11 BOOL result_flag_on = FALSE;
12 BOOL result_flag_off = FALSE;
13
14 // running this twice verifies that the first call does not set
15 // a flag that would make the second fail. Thus, the results
16 // of the two calls should be the same (no state should have changed)
17 result_flag_off = GoogleChromeCompatibilityCheck(FALSE, &reason);
18 result_flag_on = GoogleChromeCompatibilityCheck(TRUE, &reason);
12 19
13 result = GoogleChromeCompatibilityCheck(&reason); 20 if (result_flag_off != result_flag_on)
21 printf("Registry key flag is not being set properly.");
22
14 printf("Static call returned result as %d and reason as %d.\n", 23 printf("Static call returned result as %d and reason as %d.\n",
15 result, reason); 24 result_flag_on, reason);
16 } 25 }
17 26
18 void call_dynamically() { 27 void call_dynamically() {
19 HMODULE module = LoadLibrary(L"gcapi_dll.dll"); 28 HMODULE module = LoadLibrary(L"gcapi_dll.dll");
20 if (module == NULL) { 29 if (module == NULL) {
21 printf("Couldn't load gcapi_dll.dll.\n"); 30 printf("Couldn't load gcapi_dll.dll.\n");
22 return; 31 return;
23 } 32 }
24 33
25 GCCC_CompatibilityCheck gccfn = (GCCC_CompatibilityCheck) GetProcAddress( 34 GCCC_CompatibilityCheck gccfn = (GCCC_CompatibilityCheck) GetProcAddress(
26 module, "GoogleChromeCompatibilityCheck"); 35 module, "GoogleChromeCompatibilityCheck");
27 if (gccfn != NULL) { 36 if (gccfn != NULL) {
28 DWORD reason = 0; 37 DWORD reason = 0;
29 BOOL result = gccfn(&reason); 38
39 // running this twice verifies that the first call does not set
40 // a flag that would make the second fail. Thus, the results
41 // of the two calls should be the same (no state should have changed)
42 BOOL result_flag_off = gccfn(FALSE, &reason);
43 BOOL result_flag_on = gccfn(TRUE, &reason);
44
45 if (result_flag_off != result_flag_on)
46 printf("Registry key flag is not being set properly.");
47
30 printf("Dynamic call returned result as %d and reason as %d.\n", 48 printf("Dynamic call returned result as %d and reason as %d.\n",
31 result, reason); 49 result_flag_on, reason);
32 } else { 50 } else {
33 printf("Couldn't find GoogleChromeCompatibilityCheck() in gcapi_dll.\n"); 51 printf("Couldn't find GoogleChromeCompatibilityCheck() in gcapi_dll.\n");
34 } 52 }
35 FreeLibrary(module); 53 FreeLibrary(module);
36 } 54 }
37 55
38 int main(int argc, char* argv[]) { 56 int main(int argc, char* argv[]) {
39 call_dynamically(); 57 call_dynamically();
40 call_statically(); 58 call_statically();
41 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); 59 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome());
42 } 60 }
OLDNEW
« no previous file with comments | « chrome/installer/gcapi/gcapi.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698