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

Side by Side Diff: mojo/public/tests/bindings_connector_unittest.cc

Issue 64623003: Fix win64 build failure on size truncation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include "mojo/public/bindings/lib/bindings_support.h" 8 #include "mojo/public/bindings/lib/bindings_support.h"
9 #include "mojo/public/bindings/lib/connector.h" 9 #include "mojo/public/bindings/lib/connector.h"
10 #include "mojo/public/bindings/lib/message_queue.h" 10 #include "mojo/public/bindings/lib/message_queue.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 virtual void TearDown() MOJO_OVERRIDE { 51 virtual void TearDown() MOJO_OVERRIDE {
52 Close(handle0_); 52 Close(handle0_);
53 Close(handle1_); 53 Close(handle1_);
54 } 54 }
55 55
56 void AllocMessage(const char* text, Message* message) { 56 void AllocMessage(const char* text, Message* message) {
57 size_t payload_size = strlen(text) + 1; // Plus null terminator. 57 size_t payload_size = strlen(text) + 1; // Plus null terminator.
58 size_t num_bytes = sizeof(MessageHeader) + payload_size; 58 size_t num_bytes = sizeof(MessageHeader) + payload_size;
59 message->data = static_cast<MessageData*>(malloc(num_bytes)); 59 message->data = static_cast<MessageData*>(malloc(num_bytes));
60 message->data->header.num_bytes = num_bytes; 60 message->data->header.num_bytes = static_cast<uint32_t>(num_bytes);
61 message->data->header.name = 1; 61 message->data->header.name = 1;
62 memcpy(message->data->payload, text, payload_size); 62 memcpy(message->data->payload, text, payload_size);
63 } 63 }
64 64
65 void PumpMessages() { 65 void PumpMessages() {
66 bindings_support_.Process(); 66 bindings_support_.Process();
67 } 67 }
68 68
69 protected: 69 protected:
70 Handle handle0_; 70 Handle handle0_;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 std::string( 208 std::string(
209 reinterpret_cast<char*>(message_received.data->payload))); 209 reinterpret_cast<char*>(message_received.data->payload)));
210 ASSERT_EQ(2U, message_received.handles.size()); 210 ASSERT_EQ(2U, message_received.handles.size());
211 EXPECT_EQ(handles[0].value, message_received.handles[0].value); 211 EXPECT_EQ(handles[0].value, message_received.handles[0].value);
212 EXPECT_EQ(handles[1].value, message_received.handles[1].value); 212 EXPECT_EQ(handles[1].value, message_received.handles[1].value);
213 } 213 }
214 #endif 214 #endif
215 215
216 } // namespace test 216 } // namespace test
217 } // namespace mojo 217 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/js/core.cc ('k') | mojo/services/native_viewport/native_viewport_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698