blob: de4642ec5802d0df3e2eb3eb6f9b064c1712048b [file] [log] [blame]
Tom Sepez64ee2c32017-04-24 15:04:25 -07001// Copyright 2017 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
5#include "core/fxcrt/fx_memory.h"
6#include "testing/gmock/include/gmock/gmock.h"
7#include "testing/gtest/include/gtest/gtest.h"
Tom Sepez22818532020-07-22 20:40:56 +00008#include "testing/pdf_test_environment.h"
Tom Sepez3f8ee5e2018-02-09 18:26:09 +00009
Ryan Harrison4f21d772018-06-01 15:19:04 +000010#ifdef PDF_ENABLE_V8
Tom Sepezeaf9d212020-07-22 16:24:00 +000011#include "testing/v8_test_environment.h"
Tom Sepez22818532020-07-22 20:40:56 +000012#ifdef PDF_ENABLE_XFA
13#include "testing/xfa_test_environment.h"
14#endif // PDF_ENABLE_XFA
Ryan Harrison4f21d772018-06-01 15:19:04 +000015#endif // PDF_ENABLE_V8
Tom Sepez64ee2c32017-04-24 15:04:25 -070016
17// Can't use gtest-provided main since we need to initialize partition
Tom Sepez22818532020-07-22 20:40:56 +000018// alloc before invoking any test, and add test environments.
Tom Sepez64ee2c32017-04-24 15:04:25 -070019int main(int argc, char** argv) {
Tom Sepezfa7f5902022-08-15 23:10:45 +000020 FX_InitializeMemoryAllocators();
Dan Sinclair574d4402017-08-28 10:11:24 -040021
Tom Sepez22818532020-07-22 20:40:56 +000022 // PDF test environment will be deleted by gtest.
23 AddGlobalTestEnvironment(new PDFTestEnvironment());
24
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000025#ifdef PDF_ENABLE_V8
Tom Sepezeaf9d212020-07-22 16:24:00 +000026 // V8 test environment will be deleted by gtest.
27 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0]));
Ryan Harrisond60d7cb2018-06-01 15:28:54 +000028#ifdef PDF_ENABLE_XFA
Tom Sepezeaf9d212020-07-22 16:24:00 +000029 // XFA test environment will be deleted by gtest.
Tom Sepez22818532020-07-22 20:40:56 +000030 AddGlobalTestEnvironment(new XFATestEnvironment());
Dan Sinclair574d4402017-08-28 10:11:24 -040031#endif // PDF_ENABLE_XFA
Tom Sepez22818532020-07-22 20:40:56 +000032#endif // PDF_ENABLE_V8
Dan Sinclair574d4402017-08-28 10:11:24 -040033
Tom Sepez64ee2c32017-04-24 15:04:25 -070034 testing::InitGoogleTest(&argc, argv);
35 testing::InitGoogleMock(&argc, argv);
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000036
Tom Sepez22818532020-07-22 20:40:56 +000037 return RUN_ALL_TESTS();
Tom Sepez64ee2c32017-04-24 15:04:25 -070038}