| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
| 6 #include "chrome/common/gpu_info.h" | 6 #include "chrome/common/gpu_info.h" |
| 7 #include "chrome/common/gpu_messages.h" | 7 #include "chrome/common/gpu_messages.h" |
| 8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
| 9 #include "ipc/ipc_message_utils.h" | 9 #include "ipc/ipc_message_utils.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 // Test GpuFeatureFlags serialization |
| 13 TEST(GPUIPCMessageTest, GpuFeatureFlags) { |
| 14 GpuFeatureFlags input; |
| 15 input.SetFlags(false, true, false); |
| 16 |
| 17 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 18 IPC::WriteParam(&msg, input); |
| 19 |
| 20 GpuFeatureFlags output; |
| 21 void* iter = NULL; |
| 22 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); |
| 23 EXPECT_EQ(input.is_accelerated_2d_canvas_blacklisted(), |
| 24 output.is_accelerated_2d_canvas_blacklisted()); |
| 25 EXPECT_EQ(input.is_accelerated_compositing_blacklisted(), |
| 26 output.is_accelerated_compositing_blacklisted()); |
| 27 EXPECT_EQ(input.is_webgl_blacklisted(), |
| 28 output.is_webgl_blacklisted()); |
| 29 |
| 30 std::string log_message; |
| 31 IPC::LogParam(output, &log_message); |
| 32 EXPECT_STREQ("<GpuFeatureFlags> 0 1 0", log_message.c_str()); |
| 33 } |
| 34 |
| 12 // Test GPUInfo serialization | 35 // Test GPUInfo serialization |
| 13 TEST(GPUIPCMessageTest, GPUInfo) { | 36 TEST(GPUIPCMessageTest, GPUInfo) { |
| 14 GPUInfo input; | 37 GPUInfo input; |
| 15 // Test variables taken from Lenovo T61 | 38 // Test variables taken from Lenovo T61 |
| 16 input.SetProgress(GPUInfo::kPartial); | 39 input.SetProgress(GPUInfo::kPartial); |
| 17 input.SetInitializationTime(base::TimeDelta::FromMilliseconds(100)); | 40 input.SetInitializationTime(base::TimeDelta::FromMilliseconds(100)); |
| 18 input.SetGraphicsInfo(0x10de, 0x429, L"6.14.11.7715", | 41 input.SetGraphicsInfo(0x10de, 0x429, L"6.14.11.7715", |
| 19 0xffff0300, | 42 0xffff0300, |
| 20 0xfffe0300, | 43 0xfffe0300, |
| 21 0x00010005, | 44 0x00010005, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 EXPECT_EQ(input.driver_version(), output.driver_version()); | 58 EXPECT_EQ(input.driver_version(), output.driver_version()); |
| 36 EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); | 59 EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); |
| 37 EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); | 60 EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); |
| 38 EXPECT_EQ(input.gl_version(), output.gl_version()); | 61 EXPECT_EQ(input.gl_version(), output.gl_version()); |
| 39 EXPECT_EQ(input.can_lose_context(), output.can_lose_context()); | 62 EXPECT_EQ(input.can_lose_context(), output.can_lose_context()); |
| 40 | 63 |
| 41 std::string log_message; | 64 std::string log_message; |
| 42 IPC::LogParam(output, &log_message); | 65 IPC::LogParam(output, &log_message); |
| 43 EXPECT_STREQ("<GPUInfo> 1 100 10de 429 6.14.11.7715 1", log_message.c_str()); | 66 EXPECT_STREQ("<GPUInfo> 1 100 10de 429 6.14.11.7715 1", log_message.c_str()); |
| 44 } | 67 } |
| OLD | NEW |