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