| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/v8_var_converter.h" | 5 #include "content/renderer/pepper/v8_var_converter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 class V8VarConverterTest : public testing::Test { | 163 class V8VarConverterTest : public testing::Test { |
| 164 public: | 164 public: |
| 165 V8VarConverterTest() | 165 V8VarConverterTest() |
| 166 : isolate_(v8::Isolate::GetCurrent()) { | 166 : isolate_(v8::Isolate::GetCurrent()) { |
| 167 PP_Instance dummy = 1234; | 167 PP_Instance dummy = 1234; |
| 168 converter_.reset(new V8VarConverter( | 168 converter_.reset(new V8VarConverter( |
| 169 dummy, | 169 dummy, |
| 170 scoped_ptr<ResourceConverter>(new MockResourceConverter).Pass())); | 170 scoped_ptr<ResourceConverter>(new MockResourceConverter).Pass())); |
| 171 } | 171 } |
| 172 virtual ~V8VarConverterTest() {} | 172 ~V8VarConverterTest() override {} |
| 173 | 173 |
| 174 // testing::Test implementation. | 174 // testing::Test implementation. |
| 175 virtual void SetUp() { | 175 void SetUp() override { |
| 176 ProxyLock::Acquire(); | 176 ProxyLock::Acquire(); |
| 177 v8::HandleScope handle_scope(isolate_); | 177 v8::HandleScope handle_scope(isolate_); |
| 178 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); | 178 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); |
| 179 context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); | 179 context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); |
| 180 } | 180 } |
| 181 virtual void TearDown() { | 181 void TearDown() override { |
| 182 context_.Reset(); | 182 context_.Reset(); |
| 183 ASSERT_TRUE(PpapiGlobals::Get()->GetVarTracker()->GetLiveVars().empty()); | 183 ASSERT_TRUE(PpapiGlobals::Get()->GetVarTracker()->GetLiveVars().empty()); |
| 184 ProxyLock::Release(); | 184 ProxyLock::Release(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 protected: | 187 protected: |
| 188 bool FromV8ValueSync(v8::Handle<v8::Value> val, | 188 bool FromV8ValueSync(v8::Handle<v8::Value> val, |
| 189 v8::Handle<v8::Context> context, | 189 v8::Handle<v8::Context> context, |
| 190 PP_Var* result) { | 190 PP_Var* result) { |
| 191 V8VarConverter::VarResult conversion_result = | 191 V8VarConverter::VarResult conversion_result = |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 expected->SetWithStringKey("null", quux.get()); | 435 expected->SetWithStringKey("null", quux.get()); |
| 436 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); | 436 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); |
| 437 expected->SetWithStringKey("undefined", oops.get()); | 437 expected->SetWithStringKey("undefined", oops.get()); |
| 438 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); | 438 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); |
| 439 | 439 |
| 440 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); | 440 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace content | 444 } // namespace content |
| OLD | NEW |