Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: test/cctest/test-api.cc

Issue 21959003: Expose JSON parser through V8 API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 19845 matching lines...) Expand 10 before | Expand all | Expand 10 after
19856 LocalContext context; 19856 LocalContext context;
19857 v8::HandleScope scope(context->GetIsolate()); 19857 v8::HandleScope scope(context->GetIsolate());
19858 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler); 19858 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler);
19859 CompileRun("for (var i = 0; i < 128; i++) Object.prototype[i] = 0;"); 19859 CompileRun("for (var i = 0; i < 128; i++) Object.prototype[i] = 0;");
19860 Local<Function> function = templ->GetFunction(); 19860 Local<Function> function = templ->GetFunction();
19861 CHECK(!function.IsEmpty()); 19861 CHECK(!function.IsEmpty());
19862 CHECK(function->IsFunction()); 19862 CHECK(function->IsFunction());
19863 } 19863 }
19864 19864
19865 19865
19866 THREADED_TEST(JSONParse) {
19867 LocalContext context;
19868 HandleScope scope(context->GetIsolate());
19869 Local<Object> obj = v8::JSON::Parse(v8_str("{\"x\":42}"));
19870 Handle<Object> global = context->Global();
19871 global->Set(v8_str("obj"), obj);
19872 ExpectString("JSON.stringify(obj)", "{\"x\":42}");
19873 }
19874
19875
19866 #ifndef WIN32 19876 #ifndef WIN32
19867 class ThreadInterruptTest { 19877 class ThreadInterruptTest {
19868 public: 19878 public:
19869 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { } 19879 ThreadInterruptTest() : sem_(NULL), sem_value_(0) { }
19870 ~ThreadInterruptTest() { delete sem_; } 19880 ~ThreadInterruptTest() { delete sem_; }
19871 19881
19872 void RunTest() { 19882 void RunTest() {
19873 sem_ = i::OS::CreateSemaphore(0); 19883 sem_ = i::OS::CreateSemaphore(0);
19874 19884
19875 InterruptThread i_thread(this); 19885 InterruptThread i_thread(this);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
20095 CheckCorrectThrow("%HasProperty(other, 'x')"); 20105 CheckCorrectThrow("%HasProperty(other, 'x')");
20096 CheckCorrectThrow("%HasElement(other, 1)"); 20106 CheckCorrectThrow("%HasElement(other, 1)");
20097 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); 20107 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')");
20098 CheckCorrectThrow("%GetPropertyNames(other)"); 20108 CheckCorrectThrow("%GetPropertyNames(other)");
20099 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); 20109 CheckCorrectThrow("%GetLocalPropertyNames(other, true)");
20100 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" 20110 CheckCorrectThrow("%DefineOrRedefineAccessorProperty("
20101 "other, 'x', null, null, 1)"); 20111 "other, 'x', null, null, 1)");
20102 } 20112 }
20103 20113
20104 #endif // WIN32 20114 #endif // WIN32
OLDNEW
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698