blob: 7ccfdf8ce6a0d1b80b03c0723735d9898ab41466 [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 Sepez22818532020-07-22 20:40:56 +000011#include "testing/pdf_test_environment.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"
Tom Sepez22818532020-07-22 20:40:56 +000017#ifdef PDF_ENABLE_XFA
18#include "testing/xfa_test_environment.h"
19#endif // PDF_ENABLE_XFA
Ryan Harrison4f21d772018-06-01 15:19:04 +000020#endif // PDF_ENABLE_V8
Tom Sepez64ee2c32017-04-24 15:04:25 -070021
22// Can't use gtest-provided main since we need to initialize partition
Tom Sepez22818532020-07-22 20:40:56 +000023// alloc before invoking any test, and add test environments.
Tom Sepez64ee2c32017-04-24 15:04:25 -070024int main(int argc, char** argv) {
Dan Sinclairdbc3d3e2017-05-11 13:41:38 -040025 FXMEM_InitializePartitionAlloc();
Dan Sinclair574d4402017-08-28 10:11:24 -040026
Tom Sepez22818532020-07-22 20:40:56 +000027 // PDF test environment will be deleted by gtest.
28 AddGlobalTestEnvironment(new PDFTestEnvironment());
29
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000030#ifdef PDF_ENABLE_V8
Tom Sepezeaf9d212020-07-22 16:24:00 +000031 // V8 test environment will be deleted by gtest.
32 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0]));
Ryan Harrisond60d7cb2018-06-01 15:28:54 +000033#ifdef PDF_ENABLE_XFA
Tom Sepezeaf9d212020-07-22 16:24:00 +000034 // XFA test environment will be deleted by gtest.
Tom Sepez22818532020-07-22 20:40:56 +000035 AddGlobalTestEnvironment(new XFATestEnvironment());
Dan Sinclair574d4402017-08-28 10:11:24 -040036#endif // PDF_ENABLE_XFA
Tom Sepez22818532020-07-22 20:40:56 +000037#endif // PDF_ENABLE_V8
Dan Sinclair574d4402017-08-28 10:11:24 -040038
Tom Sepez64ee2c32017-04-24 15:04:25 -070039 testing::InitGoogleTest(&argc, argv);
40 testing::InitGoogleMock(&argc, argv);
Tom Sepez3f8ee5e2018-02-09 18:26:09 +000041
Tom Sepez22818532020-07-22 20:40:56 +000042 return RUN_ALL_TESTS();
Tom Sepez64ee2c32017-04-24 15:04:25 -070043}