| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "ppapi/c/dev/ppb_testing_dev.h" | 10 #include "ppapi/c/dev/ppb_testing_dev.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 PASS(); | 244 PASS(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 std::string TestPostMessage::TestSendingArrayBuffer() { | 247 std::string TestPostMessage::TestSendingArrayBuffer() { |
| 248 // Clean up after previous tests. This also swallows the message sent by Init | 248 // Clean up after previous tests. This also swallows the message sent by Init |
| 249 // if we didn't run the 'SendInInit' test. All tests other than 'SendInInit' | 249 // if we didn't run the 'SendInInit' test. All tests other than 'SendInInit' |
| 250 // should start with these. | 250 // should start with these. |
| 251 WaitForMessages(); | 251 WaitForMessages(); |
| 252 ASSERT_TRUE(ClearListeners()); | 252 ASSERT_TRUE(ClearListeners()); |
| 253 | 253 |
| 254 // TODO(dmichael): Add testing of longer array buffers when crbug.com/106266 | 254 // TODO(sehr,dmichael): Add testing of longer array buffers when |
| 255 // is fixed. | 255 // crbug.com/110086 is fixed. |
| 256 uint32_t sizes[] = { 0, 100, 1000 }; | 256 uint32_t sizes[] = { 0, 100, 1000, 10000, 100000 }; |
| 257 for (size_t i = 0; i < sizeof(sizes)/sizeof(sizes[i]); ++i) { | 257 for (size_t i = 0; i < sizeof(sizes)/sizeof(sizes[i]); ++i) { |
| 258 std::ostringstream size_stream; | 258 std::ostringstream size_stream; |
| 259 size_stream << sizes[i]; | 259 size_stream << sizes[i]; |
| 260 const std::string kSizeAsString(size_stream.str()); | 260 const std::string kSizeAsString(size_stream.str()); |
| 261 | 261 |
| 262 // Create an appropriately sized array buffer with test_data[i] == i. | 262 // Create an appropriately sized array buffer with test_data[i] == i. |
| 263 pp::VarArrayBuffer_Dev test_data(sizes[i]); | 263 pp::VarArrayBuffer_Dev test_data(sizes[i]); |
| 264 if (sizes[i] > 0) | 264 if (sizes[i] > 0) |
| 265 ASSERT_NE(NULL, test_data.Map()); | 265 ASSERT_NE(NULL, test_data.Map()); |
| 266 ASSERT_EQ(sizes[i], test_data.ByteLength()); | 266 ASSERT_EQ(sizes[i], test_data.ByteLength()); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 ASSERT_TRUE(received_value <= kThreadsToRun); | 477 ASSERT_TRUE(received_value <= kThreadsToRun); |
| 478 ++received_counts[received_value]; | 478 ++received_counts[received_value]; |
| 479 } | 479 } |
| 480 ASSERT_EQ(received_counts, expected_counts); | 480 ASSERT_EQ(received_counts, expected_counts); |
| 481 | 481 |
| 482 message_data_.clear(); | 482 message_data_.clear(); |
| 483 ASSERT_TRUE(ClearListeners()); | 483 ASSERT_TRUE(ClearListeners()); |
| 484 | 484 |
| 485 PASS(); | 485 PASS(); |
| 486 } | 486 } |
| 487 | |
| OLD | NEW |