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