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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 protected: | 170 protected: |
171 bool FromV8ValueSync(v8::Handle<v8::Value> val, | 171 bool FromV8ValueSync(v8::Handle<v8::Value> val, |
172 v8::Handle<v8::Context> context, | 172 v8::Handle<v8::Context> context, |
173 PP_Var* result) { | 173 PP_Var* result) { |
174 base::RunLoop loop; | 174 base::RunLoop loop; |
175 converter_->FromV8Value(val, context, base::Bind( | 175 converter_->FromV8Value(val, context, base::Bind( |
176 &V8VarConverterTest::FromV8ValueComplete, base::Unretained(this), | 176 &V8VarConverterTest::FromV8ValueComplete, base::Unretained(this), |
177 loop.QuitClosure())); | 177 loop.QuitClosure())); |
| 178 loop.Run(); |
178 if (conversion_success_) | 179 if (conversion_success_) |
179 *result = conversion_result_; | 180 *result = conversion_result_; |
180 return conversion_success_; | 181 return conversion_success_; |
181 } | 182 } |
182 | 183 |
183 void FromV8ValueComplete(base::Closure quit_closure, | 184 void FromV8ValueComplete(base::Closure quit_closure, |
184 const ScopedPPVar& scoped_var, | 185 const ScopedPPVar& scoped_var, |
185 bool success) { | 186 bool success) { |
186 conversion_success_ = success; | 187 conversion_success_ = success; |
187 if (success) { | 188 if (success) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); | 424 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); |
424 expected->SetWithStringKey("undefined", oops.get()); | 425 expected->SetWithStringKey("undefined", oops.get()); |
425 ScopedPPVar release_expected( | 426 ScopedPPVar release_expected( |
426 ScopedPPVar::PassRef(), expected->GetPPVar()); | 427 ScopedPPVar::PassRef(), expected->GetPPVar()); |
427 | 428 |
428 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get())); | 429 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get())); |
429 } | 430 } |
430 } | 431 } |
431 | 432 |
432 } // namespace content | 433 } // namespace content |
OLD | NEW |