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

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

Issue 11931013: Revert trunk to version 3.16.4. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 11 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
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-decls.cc » ('j') | 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifdef ENABLE_DEBUGGER_SUPPORT 28 #ifdef ENABLE_DEBUGGER_SUPPORT
29 29
30 // TODO(svenpanne): Do not use Context::GetData and Context::SetData.
31 #define V8_DISABLE_DEPRECATIONS 1
32
30 #include <stdlib.h> 33 #include <stdlib.h>
31 34
32 #include "v8.h" 35 #include "v8.h"
33 36
34 #include "api.h" 37 #include "api.h"
35 #include "cctest.h" 38 #include "cctest.h"
36 #include "compilation-cache.h" 39 #include "compilation-cache.h"
37 #include "debug.h" 40 #include "debug.h"
38 #include "deoptimizer.h" 41 #include "deoptimizer.h"
39 #include "platform.h" 42 #include "platform.h"
(...skipping 6172 matching lines...) Expand 10 before | Expand all | Expand 10 after
6212 } 6215 }
6213 6216
6214 6217
6215 static v8::Persistent<v8::Context> expected_context; 6218 static v8::Persistent<v8::Context> expected_context;
6216 static v8::Handle<v8::Value> expected_context_data; 6219 static v8::Handle<v8::Value> expected_context_data;
6217 6220
6218 6221
6219 // Check that the expected context is the one generating the debug event. 6222 // Check that the expected context is the one generating the debug event.
6220 static void ContextCheckMessageHandler(const v8::Debug::Message& message) { 6223 static void ContextCheckMessageHandler(const v8::Debug::Message& message) {
6221 CHECK(message.GetEventContext() == expected_context); 6224 CHECK(message.GetEventContext() == expected_context);
6222 CHECK(message.GetEventContext()->GetEmbedderData(0)->StrictEquals( 6225 CHECK(message.GetEventContext()->GetData()->StrictEquals(
6223 expected_context_data)); 6226 expected_context_data));
6224 message_handler_hit_count++; 6227 message_handler_hit_count++;
6225 6228
6226 static char print_buffer[1000]; 6229 static char print_buffer[1000];
6227 v8::String::Value json(message.GetJSON()); 6230 v8::String::Value json(message.GetJSON());
6228 Utf16ToAscii(*json, json.length(), print_buffer); 6231 Utf16ToAscii(*json, json.length(), print_buffer);
6229 6232
6230 // Send a continue command for break events. 6233 // Send a continue command for break events.
6231 if (IsBreakEventMessage(print_buffer)) { 6234 if (IsBreakEventMessage(print_buffer)) {
6232 SendContinueCommand(); 6235 SendContinueCommand();
(...skipping 12 matching lines...) Expand all
6245 // Create two contexts. 6248 // Create two contexts.
6246 v8::Persistent<v8::Context> context_1; 6249 v8::Persistent<v8::Context> context_1;
6247 v8::Persistent<v8::Context> context_2; 6250 v8::Persistent<v8::Context> context_2;
6248 v8::Handle<v8::ObjectTemplate> global_template = 6251 v8::Handle<v8::ObjectTemplate> global_template =
6249 v8::Handle<v8::ObjectTemplate>(); 6252 v8::Handle<v8::ObjectTemplate>();
6250 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>(); 6253 v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>();
6251 context_1 = v8::Context::New(NULL, global_template, global_object); 6254 context_1 = v8::Context::New(NULL, global_template, global_object);
6252 context_2 = v8::Context::New(NULL, global_template, global_object); 6255 context_2 = v8::Context::New(NULL, global_template, global_object);
6253 6256
6254 // Default data value is undefined. 6257 // Default data value is undefined.
6255 CHECK(context_1->GetEmbedderData(0)->IsUndefined()); 6258 CHECK(context_1->GetData()->IsUndefined());
6256 CHECK(context_2->GetEmbedderData(0)->IsUndefined()); 6259 CHECK(context_2->GetData()->IsUndefined());
6257 6260
6258 // Set and check different data values. 6261 // Set and check different data values.
6259 v8::Handle<v8::String> data_1 = v8::String::New("1"); 6262 v8::Handle<v8::String> data_1 = v8::String::New("1");
6260 v8::Handle<v8::String> data_2 = v8::String::New("2"); 6263 v8::Handle<v8::String> data_2 = v8::String::New("2");
6261 context_1->SetEmbedderData(0, data_1); 6264 context_1->SetData(data_1);
6262 context_2->SetEmbedderData(0, data_2); 6265 context_2->SetData(data_2);
6263 CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1)); 6266 CHECK(context_1->GetData()->StrictEquals(data_1));
6264 CHECK(context_2->GetEmbedderData(0)->StrictEquals(data_2)); 6267 CHECK(context_2->GetData()->StrictEquals(data_2));
6265 6268
6266 // Simple test function which causes a break. 6269 // Simple test function which causes a break.
6267 const char* source = "function f() { debugger; }"; 6270 const char* source = "function f() { debugger; }";
6268 6271
6269 // Enter and run function in the first context. 6272 // Enter and run function in the first context.
6270 { 6273 {
6271 v8::Context::Scope context_scope(context_1); 6274 v8::Context::Scope context_scope(context_1);
6272 expected_context = context_1; 6275 expected_context = context_1;
6273 expected_context_data = data_1; 6276 expected_context_data = data_1;
6274 v8::Local<v8::Function> f = CompileFunction(source, "f"); 6277 v8::Local<v8::Function> f = CompileFunction(source, "f");
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
6409 6412
6410 // Common part of EvalContextData and NestedBreakEventContextData tests. 6413 // Common part of EvalContextData and NestedBreakEventContextData tests.
6411 static void ExecuteScriptForContextCheck() { 6414 static void ExecuteScriptForContextCheck() {
6412 // Create a context. 6415 // Create a context.
6413 v8::Persistent<v8::Context> context_1; 6416 v8::Persistent<v8::Context> context_1;
6414 v8::Handle<v8::ObjectTemplate> global_template = 6417 v8::Handle<v8::ObjectTemplate> global_template =
6415 v8::Handle<v8::ObjectTemplate>(); 6418 v8::Handle<v8::ObjectTemplate>();
6416 context_1 = v8::Context::New(NULL, global_template); 6419 context_1 = v8::Context::New(NULL, global_template);
6417 6420
6418 // Default data value is undefined. 6421 // Default data value is undefined.
6419 CHECK(context_1->GetEmbedderData(0)->IsUndefined()); 6422 CHECK(context_1->GetData()->IsUndefined());
6420 6423
6421 // Set and check a data value. 6424 // Set and check a data value.
6422 v8::Handle<v8::String> data_1 = v8::String::New("1"); 6425 v8::Handle<v8::String> data_1 = v8::String::New("1");
6423 context_1->SetEmbedderData(0, data_1); 6426 context_1->SetData(data_1);
6424 CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1)); 6427 CHECK(context_1->GetData()->StrictEquals(data_1));
6425 6428
6426 // Simple test function with eval that causes a break. 6429 // Simple test function with eval that causes a break.
6427 const char* source = "function f() { eval('debugger;'); }"; 6430 const char* source = "function f() { eval('debugger;'); }";
6428 6431
6429 // Enter and run function in the context. 6432 // Enter and run function in the context.
6430 { 6433 {
6431 v8::Context::Scope context_scope(context_1); 6434 v8::Context::Scope context_scope(context_1);
6432 expected_context = context_1; 6435 expected_context = context_1;
6433 expected_context_data = data_1; 6436 expected_context_data = data_1;
6434 v8::Local<v8::Function> f = CompileFunction(source, "f"); 6437 v8::Local<v8::Function> f = CompileFunction(source, "f");
(...skipping 20 matching lines...) Expand all
6455 6458
6456 6459
6457 static bool sent_eval = false; 6460 static bool sent_eval = false;
6458 static int break_count = 0; 6461 static int break_count = 0;
6459 static int continue_command_send_count = 0; 6462 static int continue_command_send_count = 0;
6460 // Check that the expected context is the one generating the debug event 6463 // Check that the expected context is the one generating the debug event
6461 // including the case of nested break event. 6464 // including the case of nested break event.
6462 static void DebugEvalContextCheckMessageHandler( 6465 static void DebugEvalContextCheckMessageHandler(
6463 const v8::Debug::Message& message) { 6466 const v8::Debug::Message& message) {
6464 CHECK(message.GetEventContext() == expected_context); 6467 CHECK(message.GetEventContext() == expected_context);
6465 CHECK(message.GetEventContext()->GetEmbedderData(0)->StrictEquals( 6468 CHECK(message.GetEventContext()->GetData()->StrictEquals(
6466 expected_context_data)); 6469 expected_context_data));
6467 message_handler_hit_count++; 6470 message_handler_hit_count++;
6468 6471
6469 static char print_buffer[1000]; 6472 static char print_buffer[1000];
6470 v8::String::Value json(message.GetJSON()); 6473 v8::String::Value json(message.GetJSON());
6471 Utf16ToAscii(*json, json.length(), print_buffer); 6474 Utf16ToAscii(*json, json.length(), print_buffer);
6472 6475
6473 if (IsBreakEventMessage(print_buffer)) { 6476 if (IsBreakEventMessage(print_buffer)) {
6474 break_count++; 6477 break_count++;
6475 if (!sent_eval) { 6478 if (!sent_eval) {
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
7523 TEST(LiveEditDisabled) { 7526 TEST(LiveEditDisabled) {
7524 v8::internal::FLAG_allow_natives_syntax = true; 7527 v8::internal::FLAG_allow_natives_syntax = true;
7525 v8::HandleScope scope; 7528 v8::HandleScope scope;
7526 LocalContext context; 7529 LocalContext context;
7527 v8::Debug::SetLiveEditEnabled(false); 7530 v8::Debug::SetLiveEditEnabled(false);
7528 CompileRun("%LiveEditCompareStrings('', '')"); 7531 CompileRun("%LiveEditCompareStrings('', '')");
7529 } 7532 }
7530 7533
7531 7534
7532 #endif // ENABLE_DEBUGGER_SUPPORT 7535 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698