blob: 193ee6e0e9bb0cf65d646cbc029a8c6febe6495d [file] [log] [blame]
Dan Sinclair5553d8b2018-01-03 09:44:28 -05001// Copyright 2018 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
Tom Sepezeaf9d212020-07-22 16:24:00 +00005#include "build/build_config.h"
Dan Sinclair5553d8b2018-01-03 09:44:28 -05006#include "core/fxcrt/fx_memory.h"
Tom Sepez72f520c2020-08-24 23:43:46 +00007#include "testing/embedder_test_environment.h"
Dan Sinclair5553d8b2018-01-03 09:44:28 -05008#include "testing/gmock/include/gmock/gmock.h"
9#include "testing/gtest/include/gtest/gtest.h"
Dan Sinclair5553d8b2018-01-03 09:44:28 -050010
Tom Sepezeaf9d212020-07-22 16:24:00 +000011#ifdef PDF_ENABLE_V8
12#include "testing/v8_test_environment.h"
13#endif // PDF_ENABLE_V8
14
Tom Sepezaf33f512020-06-12 01:00:10 +000015// 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.
Dan Sinclair5553d8b2018-01-03 09:44:28 -050018int main(int argc, char** argv) {
Dan Sinclair5553d8b2018-01-03 09:44:28 -050019 FXMEM_InitializePartitionAlloc();
20
Tom Sepezeaf9d212020-07-22 16:24:00 +000021#ifdef PDF_ENABLE_V8
Dan Sinclair5553d8b2018-01-03 09:44:28 -050022 // The env will be deleted by gtest.
Tom Sepezeaf9d212020-07-22 16:24:00 +000023 AddGlobalTestEnvironment(new V8TestEnvironment(argv[0]));
24#endif // PDF_ENABLE_V8
Dan Sinclair5553d8b2018-01-03 09:44:28 -050025
Tom Sepez72f520c2020-08-24 23:43:46 +000026 // The env will be deleted by gtest.
27 AddGlobalTestEnvironment(new EmbedderTestEnvironment);
28
Dan Sinclair5553d8b2018-01-03 09:44:28 -050029 testing::InitGoogleTest(&argc, argv);
30 testing::InitGoogleMock(&argc, argv);
31
Tom Sepezaf33f512020-06-12 01:00:10 +000032 return RUN_ALL_TESTS();
Dan Sinclair5553d8b2018-01-03 09:44:28 -050033}