LCOV - code coverage report
Current view: top level - test/unittests - run-all-unittests.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 17 18 94.4 %
Date: 2019-01-20 Functions: 5 7 71.4 %

          Line data    Source code
       1             : // Copyright 2014 the V8 project 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 "include/libplatform/libplatform.h"
       6             : #include "include/v8.h"
       7             : #include "src/base/compiler-specific.h"
       8             : #include "testing/gmock/include/gmock/gmock.h"
       9             : 
      10             : namespace {
      11             : 
      12           0 : class DefaultPlatformEnvironment final : public ::testing::Environment {
      13             :  public:
      14        3025 :   DefaultPlatformEnvironment() = default;
      15             : 
      16        3017 :   void SetUp() override {
      17        9051 :     platform_ = v8::platform::NewDefaultPlatform(
      18             :         0, v8::platform::IdleTaskSupport::kEnabled);
      19        6034 :     ASSERT_TRUE(platform_.get() != nullptr);
      20        3017 :     v8::V8::InitializePlatform(platform_.get());
      21        6034 :     ASSERT_TRUE(v8::V8::Initialize());
      22             :   }
      23             : 
      24        3017 :   void TearDown() override {
      25        9051 :     ASSERT_TRUE(platform_.get() != nullptr);
      26        3017 :     v8::V8::Dispose();
      27        3017 :     v8::V8::ShutdownPlatform();
      28             :   }
      29             : 
      30             :  private:
      31             :   std::unique_ptr<v8::Platform> platform_;
      32             : };
      33             : 
      34             : }  // namespace
      35             : 
      36             : 
      37        3025 : int main(int argc, char** argv) {
      38             :   // Don't catch SEH exceptions and continue as the following tests might hang
      39             :   // in an broken environment on windows.
      40        3025 :   testing::GTEST_FLAG(catch_exceptions) = false;
      41        3025 :   testing::InitGoogleMock(&argc, argv);
      42        6050 :   testing::AddGlobalTestEnvironment(new DefaultPlatformEnvironment);
      43        3025 :   v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
      44        3025 :   v8::V8::InitializeExternalStartupData(argv[0]);
      45             :   return RUN_ALL_TESTS();
      46        9075 : }

Generated by: LCOV version 1.10