summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 06:14:40 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 06:14:40 +0000
commit8c797ef2f80f6280ab35ecedbc9dc4a1e4a2bfa2 (patch)
tree8577429fe0e0f910ed6ea7fea8f77bf2bb266601 /o3d/core
parent4013dfb072e3a9f901741e603aa273b6898c8011 (diff)
downloadchromium_src-8c797ef2f80f6280ab35ecedbc9dc4a1e4a2bfa2.zip
chromium_src-8c797ef2f80f6280ab35ecedbc9dc4a1e4a2bfa2.tar.gz
chromium_src-8c797ef2f80f6280ab35ecedbc9dc4a1e4a2bfa2.tar.bz2
gcc fixes
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/message_commands_test.cc77
1 files changed, 41 insertions, 36 deletions
diff --git a/o3d/core/cross/message_commands_test.cc b/o3d/core/cross/message_commands_test.cc
index add1010..b56735f 100644
--- a/o3d/core/cross/message_commands_test.cc
+++ b/o3d/core/cross/message_commands_test.cc
@@ -35,6 +35,11 @@
namespace o3d {
+#define O3D_OFFSETOF(type, field) \
+ static_cast<size_t>( \
+ reinterpret_cast<char*>(&(reinterpret_cast<type*>(1))->field) - \
+ reinterpret_cast<char *>(1))
+
class MessageCommandsTest : public testing::Test {
};
@@ -47,91 +52,91 @@ TEST_F(MessageCommandsTest, IMCMessage) {
IMCMessage msg(IMCMessage::INVALID_ID);
EXPECT_EQ(IMCMessage::INVALID_ID, msg.message_id);
EXPECT_EQ(4u, sizeof msg);
- EXPECT_EQ(0u, offsetof(IMCMessage, message_id));
+ EXPECT_EQ(0u, O3D_OFFSETOF(IMCMessage, message_id));
}
TEST_F(MessageCommandsTest, MessageInvalidIdTest) {
MessageInvalidId msg;
EXPECT_EQ(static_cast<int>(IMCMessage::INVALID_ID), 0);
- EXPECT_EQ(IMCMessage::INVALID_ID, MessageInvalidId::kMessageId);
+ //EXPECT_EQ(IMCMessage::INVALID_ID, MessageInvalidId::kMessageId);
EXPECT_EQ(IMCMessage::INVALID_ID, msg.message_id);
EXPECT_EQ(4u, sizeof(msg));
- EXPECT_EQ(0u, offsetof(MessageInvalidId, message_id));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageInvalidId, message_id));
}
TEST_F(MessageCommandsTest, MessageHelloTest) {
MessageHello msg;
EXPECT_EQ(static_cast<int>(IMCMessage::HELLO), 1);
- EXPECT_EQ(IMCMessage::HELLO, MessageHello::kMessageId);
+ //EXPECT_EQ(IMCMessage::HELLO, MessageHello::kMessageId);
EXPECT_EQ(msg.message_id, IMCMessage::HELLO);
EXPECT_EQ(4u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageHello, message_id));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageHello, message_id));
}
TEST_F(MessageCommandsTest, MessageAllocateSharedMemoryTest) {
MessageAllocateSharedMemory msg;
EXPECT_EQ(static_cast<int>(IMCMessage::ALLOCATE_SHARED_MEMORY), 2);
- EXPECT_EQ(IMCMessage::ALLOCATE_SHARED_MEMORY,
- MessageAllocateSharedMemory::kMessageId);
+ //EXPECT_EQ(IMCMessage::ALLOCATE_SHARED_MEMORY,
+ // MessageAllocateSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::ALLOCATE_SHARED_MEMORY, msg.message_id);
EXPECT_EQ(8u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageAllocateSharedMemory, message_id));
- EXPECT_EQ(4u, offsetof(MessageAllocateSharedMemory, mem_size));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageAllocateSharedMemory, message_id));
+ EXPECT_EQ(4u, O3D_OFFSETOF(MessageAllocateSharedMemory, mem_size));
}
TEST_F(MessageCommandsTest, MessageUpdateTexture2D) {
MessageUpdateTexture2D msg;
EXPECT_EQ(static_cast<int>(IMCMessage::UPDATE_TEXTURE2D), 3);
- EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, MessageUpdateTexture2D::kMessageId);
+ //EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, MessageUpdateTexture2D::kMessageId);
EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, msg.message_id);
EXPECT_EQ(24u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageUpdateTexture2D, message_id));
- EXPECT_EQ(4u, offsetof(MessageUpdateTexture2D, texture_id));
- EXPECT_EQ(8u, offsetof(MessageUpdateTexture2D, level));
- EXPECT_EQ(12u, offsetof(MessageUpdateTexture2D, shared_memory_id));
- EXPECT_EQ(16u, offsetof(MessageUpdateTexture2D, offset));
- EXPECT_EQ(20u, offsetof(MessageUpdateTexture2D, number_of_bytes));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageUpdateTexture2D, message_id));
+ EXPECT_EQ(4u, O3D_OFFSETOF(MessageUpdateTexture2D, texture_id));
+ EXPECT_EQ(8u, O3D_OFFSETOF(MessageUpdateTexture2D, level));
+ EXPECT_EQ(12u, O3D_OFFSETOF(MessageUpdateTexture2D, shared_memory_id));
+ EXPECT_EQ(16u, O3D_OFFSETOF(MessageUpdateTexture2D, offset));
+ EXPECT_EQ(20u, O3D_OFFSETOF(MessageUpdateTexture2D, number_of_bytes));
}
TEST_F(MessageCommandsTest, MessageRegisterSharedMemory) {
MessageRegisterSharedMemory msg;
EXPECT_EQ(static_cast<int>(IMCMessage::REGISTER_SHARED_MEMORY), 4);
- EXPECT_EQ(IMCMessage::REGISTER_SHARED_MEMORY,
- MessageRegisterSharedMemory::kMessageId);
+ //EXPECT_EQ(IMCMessage::REGISTER_SHARED_MEMORY,
+ // MessageRegisterSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::REGISTER_SHARED_MEMORY, msg.message_id);
EXPECT_EQ(8u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageRegisterSharedMemory, message_id));
- EXPECT_EQ(4u, offsetof(MessageRegisterSharedMemory, mem_size));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageRegisterSharedMemory, message_id));
+ EXPECT_EQ(4u, O3D_OFFSETOF(MessageRegisterSharedMemory, mem_size));
}
TEST_F(MessageCommandsTest, MessageUnregisterSharedMemory) {
MessageUnregisterSharedMemory msg;
EXPECT_EQ(static_cast<int>(IMCMessage::UNREGISTER_SHARED_MEMORY), 5);
- EXPECT_EQ(IMCMessage::UNREGISTER_SHARED_MEMORY,
- MessageUnregisterSharedMemory::kMessageId);
+ //EXPECT_EQ(IMCMessage::UNREGISTER_SHARED_MEMORY,
+ // MessageUnregisterSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::UNREGISTER_SHARED_MEMORY, msg.message_id);
EXPECT_EQ(8u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageUnregisterSharedMemory, message_id));
- EXPECT_EQ(4u, offsetof(MessageUnregisterSharedMemory, buffer_id));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageUnregisterSharedMemory, message_id));
+ EXPECT_EQ(4u, O3D_OFFSETOF(MessageUnregisterSharedMemory, buffer_id));
}
TEST_F(MessageCommandsTest, MessageUpdateTexture2DRect) {
MessageUpdateTexture2DRect msg;
EXPECT_EQ(static_cast<int>(IMCMessage::UPDATE_TEXTURE2D_RECT), 6);
- EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D_RECT,
- MessageUpdateTexture2DRect::kMessageId);
+ //EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D_RECT,
+ // MessageUpdateTexture2DRect::kMessageId);
EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D_RECT, msg.message_id);
EXPECT_EQ(40u, sizeof msg);
- EXPECT_EQ(0u, offsetof(MessageUpdateTexture2DRect, message_id));
- EXPECT_EQ(4u, offsetof(MessageUpdateTexture2DRect, texture_id));
- EXPECT_EQ(8u, offsetof(MessageUpdateTexture2DRect, level));
- EXPECT_EQ(12u, offsetof(MessageUpdateTexture2DRect, x));
- EXPECT_EQ(16u, offsetof(MessageUpdateTexture2DRect, y));
- EXPECT_EQ(20u, offsetof(MessageUpdateTexture2DRect, width));
- EXPECT_EQ(24u, offsetof(MessageUpdateTexture2DRect, height));
- EXPECT_EQ(28u, offsetof(MessageUpdateTexture2DRect, shared_memory_id));
- EXPECT_EQ(32u, offsetof(MessageUpdateTexture2DRect, offset));
- EXPECT_EQ(36u, offsetof(MessageUpdateTexture2DRect, number_of_bytes));
+ EXPECT_EQ(0u, O3D_OFFSETOF(MessageUpdateTexture2DRect, message_id));
+ EXPECT_EQ(4u, O3D_OFFSETOF(MessageUpdateTexture2DRect, texture_id));
+ EXPECT_EQ(8u, O3D_OFFSETOF(MessageUpdateTexture2DRect, level));
+ EXPECT_EQ(12u, O3D_OFFSETOF(MessageUpdateTexture2DRect, x));
+ EXPECT_EQ(16u, O3D_OFFSETOF(MessageUpdateTexture2DRect, y));
+ EXPECT_EQ(20u, O3D_OFFSETOF(MessageUpdateTexture2DRect, width));
+ EXPECT_EQ(24u, O3D_OFFSETOF(MessageUpdateTexture2DRect, height));
+ EXPECT_EQ(28u, O3D_OFFSETOF(MessageUpdateTexture2DRect, shared_memory_id));
+ EXPECT_EQ(32u, O3D_OFFSETOF(MessageUpdateTexture2DRect, offset));
+ EXPECT_EQ(36u, O3D_OFFSETOF(MessageUpdateTexture2DRect, number_of_bytes));
}
} // namespace o3d