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 "ppapi/tests/test_instance_deprecated.h" | 5 #include "ppapi/tests/test_instance_deprecated.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 | 8 |
9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 : TestCase(instance), | 67 : TestCase(instance), |
68 instance_so_(NULL) {} | 68 instance_so_(NULL) {} |
69 | 69 |
70 bool TestInstance::Init() { | 70 bool TestInstance::Init() { |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 TestInstance::~TestInstance() { | 74 TestInstance::~TestInstance() { |
75 ResetTestObject(); | 75 ResetTestObject(); |
76 if (testing_interface_->IsOutOfProcess() == PP_FALSE) { | 76 if (testing_interface_->IsOutOfProcess() == PP_FALSE) { |
77 // This should cause the instance object's descructor to be called. | 77 // This should cause the instance object's destructor to be called. |
78 testing_interface_->RunV8GC(instance_->pp_instance()); | 78 testing_interface_->RunV8GC(instance_->pp_instance()); |
79 | 79 |
80 // Test a post-condition which ensures the instance objects destructor is | 80 // Test a post-condition which ensures the instance objects destructor is |
81 // called. This only works reliably in-process. Out-of-process, it only | 81 // called. This only works reliably in-process. Out-of-process, it only |
82 // can work when the renderer stays alive a short while after the plugin | 82 // can work when the renderer stays alive a short while after the plugin |
83 // instance is destroyed. If the renderer is being shut down, too much | 83 // instance is destroyed. If the renderer is being shut down, too much |
84 // happens asynchronously for the out-of-process case to work reliably. In | 84 // happens asynchronously for the out-of-process case to work reliably. In |
85 // particular: | 85 // particular: |
86 // - The Var ReleaseObject message is asynchronous. | 86 // - The Var ReleaseObject message is asynchronous. |
87 // - The PPB_Var_Deprecated host-side proxy posts a task to actually | 87 // - The PPB_Var_Deprecated host-side proxy posts a task to actually |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // that it was set as expected. | 263 // that it was set as expected. |
264 pp::Var result = instance()->ExecuteScript( | 264 pp::Var result = instance()->ExecuteScript( |
265 "sessionStorage.getItem('instance_destroyed');"); | 265 "sessionStorage.getItem('instance_destroyed');"); |
266 ASSERT_TRUE(result.is_string()); | 266 ASSERT_TRUE(result.is_string()); |
267 ASSERT_EQ(std::string("true"), result.AsString()); | 267 ASSERT_EQ(std::string("true"), result.AsString()); |
268 instance()->ExecuteScript("sessionStorage.removeItem('instance_destroyed');"); | 268 instance()->ExecuteScript("sessionStorage.removeItem('instance_destroyed');"); |
269 | 269 |
270 PASS(); | 270 PASS(); |
271 } | 271 } |
272 | 272 |
OLD | NEW |