Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 1 | // Copyright 2018 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 5 | #include "build/build_config.h" |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 6 | #include "core/fxcrt/fx_memory.h" |
| 7 | #include "testing/gmock/include/gmock/gmock.h" |
| 8 | #include "testing/gtest/include/gtest/gtest.h" |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 9 | |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 10 | #ifdef PDF_ENABLE_V8 |
| 11 | #include "testing/v8_test_environment.h" |
| 12 | #endif // PDF_ENABLE_V8 |
| 13 | |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 14 | // Can't use gtest-provided main since we need to create our own |
| 15 | // testing environment which needs the executable path in order to |
| 16 | // find the external V8 binary data files. |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 17 | int main(int argc, char** argv) { |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 18 | FXMEM_InitializePartitionAlloc(); |
| 19 | |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 20 | #ifdef PDF_ENABLE_V8 |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 21 | // The env will be deleted by gtest. |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 22 | AddGlobalTestEnvironment(new V8TestEnvironment(argv[0])); |
| 23 | #endif // PDF_ENABLE_V8 |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 24 | |
| 25 | testing::InitGoogleTest(&argc, argv); |
| 26 | testing::InitGoogleMock(&argc, argv); |
| 27 | |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 28 | return RUN_ALL_TESTS(); |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 29 | } |