OLD | NEW |
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 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 CHECK(try_catch.Exception()->ToObject()-> | 2681 CHECK(try_catch.Exception()->ToObject()-> |
2682 Get(v8_str("a"))->Equals(v8_str("b"))); | 2682 Get(v8_str("a"))->Equals(v8_str("b"))); |
2683 } | 2683 } |
2684 | 2684 |
2685 | 2685 |
2686 bool message_received; | 2686 bool message_received; |
2687 | 2687 |
2688 | 2688 |
2689 static void check_message_0(v8::Handle<v8::Message> message, | 2689 static void check_message_0(v8::Handle<v8::Message> message, |
2690 v8::Handle<Value> data) { | 2690 v8::Handle<Value> data) { |
| 2691 CHECK_EQ(5.76, data->NumberValue()); |
2691 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); | 2692 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); |
2692 CHECK_EQ(7.56, message->GetScriptData()->NumberValue()); | 2693 CHECK_EQ(7.56, message->GetScriptData()->NumberValue()); |
2693 message_received = true; | 2694 message_received = true; |
2694 } | 2695 } |
2695 | 2696 |
2696 | 2697 |
2697 THREADED_TEST(MessageHandler0) { | 2698 THREADED_TEST(MessageHandler0) { |
2698 message_received = false; | 2699 message_received = false; |
2699 v8::HandleScope scope; | 2700 v8::HandleScope scope; |
2700 CHECK(!message_received); | 2701 CHECK(!message_received); |
2701 v8::V8::AddMessageListener(check_message_0); | 2702 v8::V8::AddMessageListener(check_message_0, v8_num(5.76)); |
2702 LocalContext context; | 2703 LocalContext context; |
2703 v8::ScriptOrigin origin = | 2704 v8::ScriptOrigin origin = |
2704 v8::ScriptOrigin(v8_str("6.75")); | 2705 v8::ScriptOrigin(v8_str("6.75")); |
2705 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), | 2706 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), |
2706 &origin); | 2707 &origin); |
2707 script->SetData(v8_str("7.56")); | 2708 script->SetData(v8_str("7.56")); |
2708 script->Run(); | 2709 script->Run(); |
2709 CHECK(message_received); | 2710 CHECK(message_received); |
2710 // clear out the message listener | 2711 // clear out the message listener |
2711 v8::V8::RemoveMessageListeners(check_message_0); | 2712 v8::V8::RemoveMessageListeners(check_message_0); |
(...skipping 15503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18215 i::Semaphore* sem_; | 18216 i::Semaphore* sem_; |
18216 volatile int sem_value_; | 18217 volatile int sem_value_; |
18217 }; | 18218 }; |
18218 | 18219 |
18219 | 18220 |
18220 THREADED_TEST(SemaphoreInterruption) { | 18221 THREADED_TEST(SemaphoreInterruption) { |
18221 ThreadInterruptTest().RunTest(); | 18222 ThreadInterruptTest().RunTest(); |
18222 } | 18223 } |
18223 | 18224 |
18224 #endif // WIN32 | 18225 #endif // WIN32 |
OLD | NEW |