| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "content/renderer/pepper/host_globals.h" | 7 #include "content/renderer/pepper/host_globals.h" |
| 8 #include "content/renderer/pepper/host_var_tracker.h" | 8 #include "content/renderer/pepper/host_var_tracker.h" |
| 9 #include "content/renderer/pepper/mock_resource.h" | 9 #include "content/renderer/pepper/mock_resource.h" |
| 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 gin::WrapperInfo MyObject::kWrapperInfo = {gin::kEmbedderNativeGin}; | 43 gin::WrapperInfo MyObject::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 44 | 44 |
| 45 class PepperTryCatchForTest : public PepperTryCatch { | 45 class PepperTryCatchForTest : public PepperTryCatch { |
| 46 public: | 46 public: |
| 47 explicit PepperTryCatchForTest(PepperPluginInstanceImpl* instance) | 47 explicit PepperTryCatchForTest(PepperPluginInstanceImpl* instance) |
| 48 : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), | 48 : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), |
| 49 handle_scope_(instance->GetIsolate()), | 49 handle_scope_(instance->GetIsolate()), |
| 50 context_scope_(v8::Context::New(instance->GetIsolate())) {} | 50 context_scope_(v8::Context::New(instance->GetIsolate())) {} |
| 51 | 51 |
| 52 virtual void SetException(const char* message) OVERRIDE { NOTREACHED(); } | 52 virtual void SetException(const char* message) override { NOTREACHED(); } |
| 53 virtual bool HasException() OVERRIDE { return false; } | 53 virtual bool HasException() override { return false; } |
| 54 virtual v8::Handle<v8::Context> GetContext() OVERRIDE { | 54 virtual v8::Handle<v8::Context> GetContext() override { |
| 55 return instance_->GetIsolate()->GetCurrentContext(); | 55 return instance_->GetIsolate()->GetCurrentContext(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 v8::HandleScope handle_scope_; | 59 v8::HandleScope handle_scope_; |
| 60 v8::Context::Scope context_scope_; | 60 v8::Context::Scope context_scope_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(PepperTryCatchForTest); | 62 DISALLOW_COPY_AND_ASSIGN(PepperTryCatchForTest); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 class HostVarTrackerTest : public PpapiUnittest { | 67 class HostVarTrackerTest : public PpapiUnittest { |
| 68 public: | 68 public: |
| 69 HostVarTrackerTest() {} | 69 HostVarTrackerTest() {} |
| 70 | 70 |
| 71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() override { |
| 72 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( | 72 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting( |
| 73 v8::Isolate::kFullGarbageCollection); | 73 v8::Isolate::kFullGarbageCollection); |
| 74 EXPECT_EQ(0, g_v8objects_alive); | 74 EXPECT_EQ(0, g_v8objects_alive); |
| 75 PpapiUnittest::TearDown(); | 75 PpapiUnittest::TearDown(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 HostVarTracker& tracker() { return *HostGlobals::Get()->host_var_tracker(); } | 78 HostVarTracker& tracker() { return *HostGlobals::Get()->host_var_tracker(); } |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) { | 81 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 pp_object1 = ppapi::ScopedPPVar(); | 126 pp_object1 = ppapi::ScopedPPVar(); |
| 127 pp_object2 = ppapi::ScopedPPVar(); | 127 pp_object2 = ppapi::ScopedPPVar(); |
| 128 | 128 |
| 129 // Releasing the resource should free the internal ref, and so making a new | 129 // Releasing the resource should free the internal ref, and so making a new |
| 130 // one now should generate a new ID. | 130 // one now should generate a new ID. |
| 131 ppapi::ScopedPPVar pp_object3 = try_catch.FromV8(v8_object); | 131 ppapi::ScopedPPVar pp_object3 = try_catch.FromV8(v8_object); |
| 132 EXPECT_NE(pp_object1.get().value.as_id, pp_object3.get().value.as_id); | 132 EXPECT_NE(pp_object1.get().value.as_id, pp_object3.get().value.as_id); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |