1 // Copyright 2018 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 "build/build_config.h" 6 #include "core/fxcrt/fx_memory.h" 7 #include "testing/embedder_test_environment.h" 8 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gtest/include/gtest/gtest.h" 10 11 #ifdef PDF_ENABLE_V8 12 #include "testing/v8_test_environment.h" 13 #endif // PDF_ENABLE_V8 14 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. main(int argc,char ** argv)18int main(int argc, char** argv) { 19 FX_InitializeMemoryAllocators(); 20 21 #ifdef PDF_ENABLE_V8 22 // The env will be deleted by gtest. 23 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0])); 24 #endif // PDF_ENABLE_V8 25 26 // The env will be deleted by gtest. 27 AddGlobalTestEnvironment(new EmbedderTestEnvironment); 28 29 testing::InitGoogleTest(&argc, argv); 30 testing::InitGoogleMock(&argc, argv); 31 32 // Anything remaining in argc/argv is an embedder_tests flag. 33 EmbedderTestEnvironment::GetInstance()->AddFlags(argc, argv); 34 35 return RUN_ALL_TESTS(); 36 } 37