1 // Copyright 2017 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "core/fxcrt/fx_memory.h" 6 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/pdf_test_environment.h" 9 10 #if defined(PDF_USE_PARTITION_ALLOC) 11 #include "testing/allocator_shim_config.h" 12 #endif 13 14 #ifdef PDF_ENABLE_V8 15 #include "testing/v8_test_environment.h" 16 #ifdef PDF_ENABLE_XFA 17 #include "testing/xfa_test_environment.h" 18 #endif // PDF_ENABLE_XFA 19 #endif // PDF_ENABLE_V8 20 21 // Can't use gtest-provided main since we need to initialize partition 22 // alloc before invoking any test, and add test environments. main(int argc,char ** argv)23int main(int argc, char** argv) { 24 #if defined(PDF_USE_PARTITION_ALLOC) 25 pdfium::ConfigurePartitionAllocShimPartitionForTest(); 26 #endif // defined(PDF_USE_PARTITION_ALLOC) 27 28 FX_InitializeMemoryAllocators(); 29 30 // PDF test environment will be deleted by gtest. 31 AddGlobalTestEnvironment(new PDFTestEnvironment()); 32 33 #ifdef PDF_ENABLE_V8 34 // V8 test environment will be deleted by gtest. 35 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0])); 36 #ifdef PDF_ENABLE_XFA 37 // XFA test environment will be deleted by gtest. 38 AddGlobalTestEnvironment(new XFATestEnvironment()); 39 #endif // PDF_ENABLE_XFA 40 #endif // PDF_ENABLE_V8 41 42 testing::InitGoogleTest(&argc, argv); 43 testing::InitGoogleMock(&argc, argv); 44 45 return RUN_ALL_TESTS(); 46 } 47