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

Side by Side Diff: ppapi/tests/test_post_message.cc

Issue 1440423003: Add support for HandleBlockingMessage to NaClMessageScanner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra whitespace Created 5 years, 1 month 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
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return expected == actual; 123 return expected == actual;
124 } 124 }
125 } 125 }
126 126
127 bool VarsEqual(const pp::Var& expected, 127 bool VarsEqual(const pp::Var& expected,
128 const pp::Var& actual) { 128 const pp::Var& actual) {
129 std::map<int64_t, int64_t> visited_ids; 129 std::map<int64_t, int64_t> visited_ids;
130 return VarsEqual(expected, actual, &visited_ids); 130 return VarsEqual(expected, actual, &visited_ids);
131 } 131 }
132 132
133 class ScopedArrayBufferSizeSetter {
134 public:
135 ScopedArrayBufferSizeSetter(const PPB_Testing_Private* interface,
136 PP_Instance instance,
137 uint32_t threshold)
138 : interface_(interface),
139 instance_(instance) {
140 interface_->SetMinimumArrayBufferSizeForShmem(instance_, threshold);
141 }
142 ~ScopedArrayBufferSizeSetter() {
143 interface_->SetMinimumArrayBufferSizeForShmem(instance_, 0);
144 }
145 private:
146 const PPB_Testing_Private* interface_;
147 PP_Instance instance_;
148 };
149
150 #define FINISHED_WAITING_MESSAGE "TEST_POST_MESSAGE_FINISHED_WAITING" 133 #define FINISHED_WAITING_MESSAGE "TEST_POST_MESSAGE_FINISHED_WAITING"
151 134
152 } // namespace 135 } // namespace
153 136
154 TestPostMessage::TestPostMessage(TestingInstance* instance) 137 TestPostMessage::TestPostMessage(TestingInstance* instance)
155 : TestCase(instance) { 138 : TestCase(instance) {
156 } 139 }
157 140
158 TestPostMessage::~TestPostMessage() { 141 TestPostMessage::~TestPostMessage() {
159 instance_->PostMessage(pp::Var("This isn't guaranteed to be received, but " 142 instance_->PostMessage(pp::Var("This isn't guaranteed to be received, but "
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 ASSERT_TRUE(received_value <= kThreadsToRun); 892 ASSERT_TRUE(received_value <= kThreadsToRun);
910 ++received_counts[received_value]; 893 ++received_counts[received_value];
911 } 894 }
912 ASSERT_EQ(expected_counts, received_counts); 895 ASSERT_EQ(expected_counts, received_counts);
913 896
914 message_data_.clear(); 897 message_data_.clear();
915 ASSERT_TRUE(ClearListeners()); 898 ASSERT_TRUE(ClearListeners());
916 899
917 PASS(); 900 PASS();
918 } 901 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698