| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gin/test/gtest.h" | 5 #include "gin/test/gtest.h" |
| 6 | 6 |
| 7 #include "gin/arguments.h" | 7 #include "gin/arguments.h" |
| 8 #include "gin/converter.h" | 8 #include "gin/converter.h" |
| 9 #include "gin/per_isolate_data.h" | 9 #include "gin/per_isolate_data.h" |
| 10 #include "gin/wrapper_info.h" | 10 #include "gin/wrapper_info.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 std::string description; | 48 std::string description; |
| 49 if (!ConvertFromV8(info[2], &description)) | 49 if (!ConvertFromV8(info[2], &description)) |
| 50 return args.ThrowTypeError("Expected description."); | 50 return args.ThrowTypeError("Expected description."); |
| 51 | 51 |
| 52 EXPECT_TRUE(info[0]->StrictEquals(info[1])) << description; | 52 EXPECT_TRUE(info[0]->StrictEquals(info[1])) << description; |
| 53 } | 53 } |
| 54 | 54 |
| 55 WrapperInfo g_gtest_wrapper_info = {}; | 55 WrapperInfo g_gtest_wrapper_info = {}; |
| 56 | 56 |
| 57 } | 57 } // namespace |
| 58 | 58 |
| 59 v8::Local<v8::ObjectTemplate> GetGTestTemplate(v8::Isolate* isolate) { | 59 const char GTest::kModuleName[] = "gtest"; |
| 60 |
| 61 v8::Local<v8::ObjectTemplate> GTest::GetTemplate(v8::Isolate* isolate) { |
| 60 PerIsolateData* data = PerIsolateData::From(isolate); | 62 PerIsolateData* data = PerIsolateData::From(isolate); |
| 61 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( | 63 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate( |
| 62 &g_gtest_wrapper_info); | 64 &g_gtest_wrapper_info); |
| 63 if (templ.IsEmpty()) { | 65 if (templ.IsEmpty()) { |
| 64 templ = v8::ObjectTemplate::New(); | 66 templ = v8::ObjectTemplate::New(); |
| 65 templ->Set(StringToSymbol(isolate, "expectTrue"), | 67 templ->Set(StringToSymbol(isolate, "expectTrue"), |
| 66 v8::FunctionTemplate::New(ExpectTrue)); | 68 v8::FunctionTemplate::New(ExpectTrue)); |
| 67 templ->Set(StringToSymbol(isolate, "expectFalse"), | 69 templ->Set(StringToSymbol(isolate, "expectFalse"), |
| 68 v8::FunctionTemplate::New(ExpectFalse)); | 70 v8::FunctionTemplate::New(ExpectFalse)); |
| 69 templ->Set(StringToSymbol(isolate, "expectEqual"), | 71 templ->Set(StringToSymbol(isolate, "expectEqual"), |
| 70 v8::FunctionTemplate::New(ExpectEqual)); | 72 v8::FunctionTemplate::New(ExpectEqual)); |
| 71 data->SetObjectTemplate(&g_gtest_wrapper_info, templ); | 73 data->SetObjectTemplate(&g_gtest_wrapper_info, templ); |
| 72 } | 74 } |
| 73 return templ; | 75 return templ; |
| 74 } | 76 } |
| 75 | 77 |
| 76 } // namespace gin | 78 } // namespace gin |
| OLD | NEW |