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" |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame^] | 7 | #include "testing/embedder_test_environment.h" |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 8 | #include "testing/gmock/include/gmock/gmock.h" |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 10 | |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 11 | #ifdef PDF_ENABLE_V8 |
| 12 | #include "testing/v8_test_environment.h" |
| 13 | #endif // PDF_ENABLE_V8 |
| 14 | |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 15 | // Can't use gtest-provided main since we need to create our own |
| 16 | // testing environment which needs the executable path in order to |
| 17 | // find the external V8 binary data files. |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 18 | int main(int argc, char** argv) { |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 19 | FXMEM_InitializePartitionAlloc(); |
| 20 | |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 21 | #ifdef PDF_ENABLE_V8 |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 22 | // The env will be deleted by gtest. |
Tom Sepez | eaf9d21 | 2020-07-22 16:24:00 +0000 | [diff] [blame] | 23 | AddGlobalTestEnvironment(new V8TestEnvironment(argv[0])); |
| 24 | #endif // PDF_ENABLE_V8 |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 25 | |
Tom Sepez | 72f520c | 2020-08-24 23:43:46 +0000 | [diff] [blame^] | 26 | // The env will be deleted by gtest. |
| 27 | AddGlobalTestEnvironment(new EmbedderTestEnvironment); |
| 28 | |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 29 | testing::InitGoogleTest(&argc, argv); |
| 30 | testing::InitGoogleMock(&argc, argv); |
| 31 | |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 32 | return RUN_ALL_TESTS(); |
Dan Sinclair | 5553d8b | 2018-01-03 09:44:28 -0500 | [diff] [blame] | 33 | } |