| 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 "ppapi/tests/test_post_message.h" | 5 #include "ppapi/tests/test_post_message.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 ASSERT_TRUE(message_data_.back().is_bool()); | 304 ASSERT_TRUE(message_data_.back().is_bool()); |
| 305 if (!message_data_.back().AsBool()) | 305 if (!message_data_.back().AsBool()) |
| 306 return std::string("Failed: ") + *iter; | 306 return std::string("Failed: ") + *iter; |
| 307 ASSERT_TRUE(message_data_.back().AsBool()); | 307 ASSERT_TRUE(message_data_.back().AsBool()); |
| 308 ASSERT_TRUE(ClearListeners()); | 308 ASSERT_TRUE(ClearListeners()); |
| 309 } | 309 } |
| 310 PASS(); | 310 PASS(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 std::string TestPostMessage::TestSendInInit() { | 313 std::string TestPostMessage::TestSendInInit() { |
| 314 ASSERT_EQ(1, WaitForMessages()); | 314 // Wait for the messages from Init() to be guaranteed to be sent. |
| 315 WaitForMessages(); |
| 315 // This test assumes Init already sent a message. | 316 // This test assumes Init already sent a message. |
| 316 ASSERT_EQ(1, message_data_.size()); | 317 ASSERT_EQ(1, message_data_.size()); |
| 317 ASSERT_TRUE(message_data_.back().is_string()); | 318 ASSERT_TRUE(message_data_.back().is_string()); |
| 318 ASSERT_EQ(kTestString, message_data_.back().AsString()); | 319 ASSERT_EQ(kTestString, message_data_.back().AsString()); |
| 319 message_data_.clear(); | 320 message_data_.clear(); |
| 320 PASS(); | 321 PASS(); |
| 321 } | 322 } |
| 322 | 323 |
| 323 std::string TestPostMessage::TestSendingData() { | 324 std::string TestPostMessage::TestSendingData() { |
| 324 // Clean up after previous tests. This also swallows the message sent by Init | 325 // Clean up after previous tests. This also swallows the message sent by Init |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 ASSERT_TRUE(received_value <= kThreadsToRun); | 901 ASSERT_TRUE(received_value <= kThreadsToRun); |
| 901 ++received_counts[received_value]; | 902 ++received_counts[received_value]; |
| 902 } | 903 } |
| 903 ASSERT_EQ(expected_counts, received_counts); | 904 ASSERT_EQ(expected_counts, received_counts); |
| 904 | 905 |
| 905 message_data_.clear(); | 906 message_data_.clear(); |
| 906 ASSERT_TRUE(ClearListeners()); | 907 ASSERT_TRUE(ClearListeners()); |
| 907 | 908 |
| 908 PASS(); | 909 PASS(); |
| 909 } | 910 } |
| OLD | NEW |