OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/installer/gcapi/gcapi.h" | 9 #include "chrome/installer/gcapi/gcapi.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 void call_statically() { | 12 void call_statically() { |
13 DWORD reason = 0; | 13 DWORD reason = 0; |
14 BOOL result_flag_on = FALSE; | 14 BOOL result_flag_on = FALSE; |
15 BOOL result_flag_off = FALSE; | 15 BOOL result_flag_off = FALSE; |
16 | 16 |
17 // running this twice verifies that the first call does not set | 17 // running this twice verifies that the first call does not set |
18 // a flag that would make the second fail. Thus, the results | 18 // a flag that would make the second fail. Thus, the results |
19 // of the two calls should be the same (no state should have changed) | 19 // of the two calls should be the same (no state should have changed) |
20 result_flag_off = GoogleChromeCompatibilityCheck( | 20 result_flag_off = GoogleChromeCompatibilityCheck( |
21 FALSE, GCAPI_INVOKED_STANDARD_SHELL, &reason); | 21 FALSE, GCAPI_INVOKED_STANDARD_SHELL, &reason); |
22 result_flag_on = GoogleChromeCompatibilityCheck( | 22 result_flag_on = GoogleChromeCompatibilityCheck( |
23 TRUE, GCAPI_INVOKED_STANDARD_SHELL, &reason); | 23 TRUE, GCAPI_INVOKED_STANDARD_SHELL, &reason); |
24 | 24 |
25 if (result_flag_off != result_flag_on) | 25 if (result_flag_off != result_flag_on) |
26 printf("Registry key flag is not being set properly."); | 26 printf("Registry key flag is not being set properly."); |
27 | 27 |
28 printf("Static call returned result as %d and reason as %d.\n", | 28 printf("Static call returned result as %ld and reason as %ld.\n", |
scottmg
2014/09/05 01:31:24
lu for the second one?
| |
29 result_flag_on, reason); | 29 result_flag_on, reason); |
30 } | 30 } |
31 | 31 |
32 void call_dynamically() { | 32 void call_dynamically() { |
33 HMODULE module = LoadLibrary(L"gcapi_dll.dll"); | 33 HMODULE module = LoadLibrary(L"gcapi_dll.dll"); |
34 if (module == NULL) { | 34 if (module == NULL) { |
35 printf("Couldn't load gcapi_dll.dll.\n"); | 35 printf("Couldn't load gcapi_dll.dll.\n"); |
36 return; | 36 return; |
37 } | 37 } |
38 | 38 |
(...skipping 27 matching lines...) Expand all Loading... | |
66 | 66 |
67 testing::InitGoogleTest(&argc, argv); | 67 testing::InitGoogleTest(&argc, argv); |
68 RUN_ALL_TESTS(); | 68 RUN_ALL_TESTS(); |
69 | 69 |
70 if (CommandLine::ForCurrentProcess()->HasSwitch(kManualLaunchTests)) { | 70 if (CommandLine::ForCurrentProcess()->HasSwitch(kManualLaunchTests)) { |
71 call_dynamically(); | 71 call_dynamically(); |
72 call_statically(); | 72 call_statically(); |
73 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); | 73 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); |
74 } | 74 } |
75 } | 75 } |
OLD | NEW |