Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: test/compiler-unittests/compiler-unittests.cc

Issue 447563003: Add initial support for compiler unit tests using GTest/GMock. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 "test/compiler-unittests/compiler-unittests.h"
7 #include "testing/gmock/include/gmock/gmock.h"
8
9 using ::testing::IsNull;
10 using ::testing::NotNull;
11
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15
16 // static
17 v8::Isolate* CompilerTest::isolate_ = NULL;
18
19
20 CompilerTest::CompilerTest()
21 : isolate_scope_(isolate_),
22 handle_scope_(isolate_),
23 context_scope_(v8::Context::New(isolate_)),
24 zone_(isolate()) {}
25
26
27 CompilerTest::~CompilerTest() {}
28
29
30 // static
31 void CompilerTest::SetUpTestCase() {
32 Test::SetUpTestCase();
33 EXPECT_THAT(isolate_, IsNull());
34 isolate_ = v8::Isolate::New();
35 ASSERT_THAT(isolate_, NotNull());
36 }
37
38
39 // static
40 void CompilerTest::TearDownTestCase() {
41 ASSERT_THAT(isolate_, NotNull());
42 isolate_->Dispose();
43 isolate_ = NULL;
44 Test::TearDownTestCase();
45 }
46
47 } // namespace compiler
48 } // namespace internal
49 } // namespace v8
50
51
52 namespace {
53
54 class CompilerTestEnvironment V8_FINAL : public ::testing::Environment {
55 public:
56 CompilerTestEnvironment() : platform_(NULL) {}
57 ~CompilerTestEnvironment() {}
58
59 virtual void SetUp() V8_OVERRIDE {
60 ASSERT_THAT(platform_, IsNull());
61 platform_ = v8::platform::CreateDefaultPlatform();
62 v8::V8::InitializePlatform(platform_);
63 ASSERT_TRUE(v8::V8::Initialize());
64 }
65
66 virtual void TearDown() V8_OVERRIDE {
67 ASSERT_THAT(platform_, NotNull());
68 v8::V8::Dispose();
69 v8::V8::ShutdownPlatform();
70 delete platform_;
71 platform_ = NULL;
72 }
73
74 private:
75 v8::Platform* platform_;
76 };
77
78 }
79
80
81 int main(int argc, char** argv) {
82 testing::InitGoogleMock(&argc, argv);
83 testing::AddGlobalTestEnvironment(new CompilerTestEnvironment);
84 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
85 return RUN_ALL_TESTS();
86 }
OLDNEW
« no previous file with comments | « test/compiler-unittests/compiler-unittests.h ('k') | test/compiler-unittests/compiler-unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698