blob: b36ac806ede9ddf3a43de37f0ef0a800ab075420 [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
Dan Sinclair574d4402017-08-28 10:11:24 -04005#include <memory>
Tom Sepez3f8ee5e2018-02-09 18:26:09 +00006#include <string>
Dan Sinclair574d4402017-08-28 10:11:24 -04007
Tom Sepez64ee2c32017-04-24 15:04:25 -07008#include "core/fxcrt/fx_memory.h"
9#include "testing/gmock/include/gmock/gmock.h"
10#include "testing/gtest/include/gtest/gtest.h"
Tom Sepez78f68192019-05-31 17:28:15 +000011#include "testing/test_support.h"
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000012
Ryan Harrison4f21d772018-06-01 15:19:04 +000013#ifdef PDF_ENABLE_V8
Tom Sepezeaf9d212020-07-22 16:24:00 +000014#include "testing/v8_test_environment.h"
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000015#include "v8/include/v8-platform.h"
16#include "v8/include/v8.h"
Ryan Harrison4f21d772018-06-01 15:19:04 +000017#endif // PDF_ENABLE_V8
Tom Sepez64ee2c32017-04-24 15:04:25 -070018
Ryan Harrisond60d7cb2018-06-01 15:28:54 +000019#ifdef PDF_ENABLE_XFA
Lei Zhang220ef3d2019-02-05 20:40:54 +000020#include "testing/xfa_unit_test_support.h"
Dan Sinclair574d4402017-08-28 10:11:24 -040021#endif // PDF_ENABLE_XFA
22
Tom Sepez64ee2c32017-04-24 15:04:25 -070023// Can't use gtest-provided main since we need to initialize partition
24// alloc before invoking any test.
25int main(int argc, char** argv) {
Dan Sinclairdbc3d3e2017-05-11 13:41:38 -040026 FXMEM_InitializePartitionAlloc();
Dan Sinclair574d4402017-08-28 10:11:24 -040027
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000028#ifdef PDF_ENABLE_V8
Tom Sepezeaf9d212020-07-22 16:24:00 +000029 // V8 test environment will be deleted by gtest.
30 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0]));
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000031#endif // PDF_ENABLE_V8
32
Tom Sepez78f68192019-05-31 17:28:15 +000033 InitializePDFTestEnvironment();
Tom Sepezeaf9d212020-07-22 16:24:00 +000034
Ryan Harrisond60d7cb2018-06-01 15:28:54 +000035#ifdef PDF_ENABLE_XFA
Tom Sepezeaf9d212020-07-22 16:24:00 +000036 // XFA test environment will be deleted by gtest.
Lei Zhang220ef3d2019-02-05 20:40:54 +000037 InitializeXFATestEnvironment();
Dan Sinclair574d4402017-08-28 10:11:24 -040038#endif // PDF_ENABLE_XFA
39
Tom Sepez64ee2c32017-04-24 15:04:25 -070040 testing::InitGoogleTest(&argc, argv);
41 testing::InitGoogleMock(&argc, argv);
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000042
43 int ret_val = RUN_ALL_TESTS();
44
Tom Sepez78f68192019-05-31 17:28:15 +000045 DestroyPDFTestEnvironment();
Tom Sepez78f68192019-05-31 17:28:15 +000046
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000047
48 return ret_val;
Tom Sepez64ee2c32017-04-24 15:04:25 -070049}