| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" |
| 7 #include "chrome/installer/gcapi/gcapi.h" | 8 #include "chrome/installer/gcapi/gcapi.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 10 |
| 10 void call_statically() { | 11 void call_statically() { |
| 11 DWORD reason = 0; | 12 DWORD reason = 0; |
| 12 BOOL result_flag_on = FALSE; | 13 BOOL result_flag_on = FALSE; |
| 13 BOOL result_flag_off = FALSE; | 14 BOOL result_flag_off = FALSE; |
| 14 | 15 |
| 15 // running this twice verifies that the first call does not set | 16 // running this twice verifies that the first call does not set |
| 16 // a flag that would make the second fail. Thus, the results | 17 // a flag that would make the second fail. Thus, the results |
| (...skipping 30 matching lines...) Expand all Loading... |
| 47 printf("Registry key flag is not being set properly."); | 48 printf("Registry key flag is not being set properly."); |
| 48 | 49 |
| 49 printf("Dynamic call returned result as %d and reason as %d.\n", | 50 printf("Dynamic call returned result as %d and reason as %d.\n", |
| 50 result_flag_on, reason); | 51 result_flag_on, reason); |
| 51 } else { | 52 } else { |
| 52 printf("Couldn't find GoogleChromeCompatibilityCheck() in gcapi_dll.\n"); | 53 printf("Couldn't find GoogleChromeCompatibilityCheck() in gcapi_dll.\n"); |
| 53 } | 54 } |
| 54 FreeLibrary(module); | 55 FreeLibrary(module); |
| 55 } | 56 } |
| 56 | 57 |
| 58 const char kManualLaunchTests[] = "launch-chrome"; |
| 59 |
| 57 int main(int argc, char* argv[]) { | 60 int main(int argc, char* argv[]) { |
| 61 CommandLine::Init(argc, argv); |
| 62 |
| 58 testing::InitGoogleTest(&argc, argv); | 63 testing::InitGoogleTest(&argc, argv); |
| 59 RUN_ALL_TESTS(); | 64 RUN_ALL_TESTS(); |
| 60 | 65 |
| 61 call_dynamically(); | 66 if (CommandLine::ForCurrentProcess()->HasSwitch(kManualLaunchTests)) { |
| 62 call_statically(); | 67 call_dynamically(); |
| 63 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); | 68 call_statically(); |
| 69 printf("LaunchChrome returned %d.\n", LaunchGoogleChrome()); |
| 70 } |
| 64 } | 71 } |
| OLD | NEW |