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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 v8::Isolate* isolate_; | 229 v8::Isolate* isolate_; |
230 | 230 |
231 // Context for the JavaScript in the test. | 231 // Context for the JavaScript in the test. |
232 v8::Persistent<v8::Context> context_; | 232 v8::Persistent<v8::Context> context_; |
233 | 233 |
234 scoped_ptr<V8VarConverter> converter_; | 234 scoped_ptr<V8VarConverter> converter_; |
235 | 235 |
236 private: | 236 private: |
| 237 base::MessageLoop message_loop_; // Required to receive callbacks. |
| 238 |
237 TestGlobals globals_; | 239 TestGlobals globals_; |
238 | |
239 base::MessageLoop message_loop_; | |
240 }; | 240 }; |
241 | 241 |
242 } // namespace | 242 } // namespace |
243 | 243 |
244 TEST_F(V8VarConverterTest, SimpleRoundTripTest) { | 244 TEST_F(V8VarConverterTest, SimpleRoundTripTest) { |
245 EXPECT_TRUE(RoundTripAndCompare(PP_MakeUndefined())); | 245 EXPECT_TRUE(RoundTripAndCompare(PP_MakeUndefined())); |
246 EXPECT_TRUE(RoundTripAndCompare(PP_MakeNull())); | 246 EXPECT_TRUE(RoundTripAndCompare(PP_MakeNull())); |
247 EXPECT_TRUE(RoundTripAndCompare(PP_MakeInt32(100))); | 247 EXPECT_TRUE(RoundTripAndCompare(PP_MakeInt32(100))); |
248 EXPECT_TRUE(RoundTripAndCompare(PP_MakeBool(PP_TRUE))); | 248 EXPECT_TRUE(RoundTripAndCompare(PP_MakeBool(PP_TRUE))); |
249 EXPECT_TRUE(RoundTripAndCompare(PP_MakeDouble(53.75))); | 249 EXPECT_TRUE(RoundTripAndCompare(PP_MakeDouble(53.75))); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 expected->SetWithStringKey("null", quux.get()); | 437 expected->SetWithStringKey("null", quux.get()); |
438 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); | 438 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); |
439 expected->SetWithStringKey("undefined", oops.get()); | 439 expected->SetWithStringKey("undefined", oops.get()); |
440 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); | 440 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); |
441 | 441 |
442 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); | 442 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 } // namespace content | 446 } // namespace content |
OLD | NEW |