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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ppapi/shared_impl/array_var.h" | 22 #include "ppapi/shared_impl/array_var.h" |
23 #include "ppapi/shared_impl/dictionary_var.h" | 23 #include "ppapi/shared_impl/dictionary_var.h" |
24 #include "ppapi/shared_impl/ppapi_globals.h" | 24 #include "ppapi/shared_impl/ppapi_globals.h" |
25 #include "ppapi/shared_impl/proxy_lock.h" | 25 #include "ppapi/shared_impl/proxy_lock.h" |
26 #include "ppapi/shared_impl/scoped_pp_var.h" | 26 #include "ppapi/shared_impl/scoped_pp_var.h" |
27 #include "ppapi/shared_impl/test_globals.h" | 27 #include "ppapi/shared_impl/test_globals.h" |
28 #include "ppapi/shared_impl/test_utils.h" | 28 #include "ppapi/shared_impl/test_utils.h" |
29 #include "ppapi/shared_impl/var.h" | 29 #include "ppapi/shared_impl/var.h" |
30 #include "ppapi/shared_impl/var_tracker.h" | 30 #include "ppapi/shared_impl/var_tracker.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" | |
33 #include "v8/include/v8.h" | 32 #include "v8/include/v8.h" |
34 | 33 |
35 using ppapi::ArrayBufferVar; | 34 using ppapi::ArrayBufferVar; |
36 using ppapi::ArrayVar; | 35 using ppapi::ArrayVar; |
37 using ppapi::DictionaryVar; | 36 using ppapi::DictionaryVar; |
38 using ppapi::PpapiGlobals; | 37 using ppapi::PpapiGlobals; |
39 using ppapi::ProxyLock; | 38 using ppapi::ProxyLock; |
40 using ppapi::ScopedPPVar; | 39 using ppapi::ScopedPPVar; |
41 using ppapi::StringVar; | 40 using ppapi::StringVar; |
42 using ppapi::TestGlobals; | 41 using ppapi::TestGlobals; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 dictionary->SetWithStringKey("x.y", PP_MakeUndefined()); | 396 dictionary->SetWithStringKey("x.y", PP_MakeUndefined()); |
398 EXPECT_TRUE(RoundTripAndCompare(dictionary->GetPPVar())); | 397 EXPECT_TRUE(RoundTripAndCompare(dictionary->GetPPVar())); |
399 } | 398 } |
400 | 399 |
401 { | 400 { |
402 // Test non-string key types. They should be cast to strings. | 401 // Test non-string key types. They should be cast to strings. |
403 v8::HandleScope handle_scope(isolate_); | 402 v8::HandleScope handle_scope(isolate_); |
404 v8::Local<v8::Context> context = | 403 v8::Local<v8::Context> context = |
405 v8::Local<v8::Context>::New(isolate_, context_); | 404 v8::Local<v8::Context>::New(isolate_, context_); |
406 v8::Context::Scope context_scope(context); | 405 v8::Context::Scope context_scope(context); |
407 blink::WebScopedMicrotaskSuppression microtasks_scope; | |
408 | 406 |
409 const char* source = | 407 const char* source = |
410 "(function() {" | 408 "(function() {" |
411 "return {" | 409 "return {" |
412 "1: 'foo'," | 410 "1: 'foo'," |
413 "'2': 'bar'," | 411 "'2': 'bar'," |
414 "true: 'baz'," | 412 "true: 'baz'," |
415 "false: 'qux'," | 413 "false: 'qux'," |
416 "null: 'quux'," | 414 "null: 'quux'," |
417 "undefined: 'oops'" | 415 "undefined: 'oops'" |
(...skipping 23 matching lines...) Expand all Loading... |
441 expected->SetWithStringKey("null", quux.get()); | 439 expected->SetWithStringKey("null", quux.get()); |
442 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); | 440 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); |
443 expected->SetWithStringKey("undefined", oops.get()); | 441 expected->SetWithStringKey("undefined", oops.get()); |
444 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); | 442 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); |
445 | 443 |
446 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); | 444 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); |
447 } | 445 } |
448 } | 446 } |
449 | 447 |
450 } // namespace content | 448 } // namespace content |
OLD | NEW |