| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string.h> | 5 #include <string.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/common/common_param_traits.h" | 10 #include "chrome/common/common_param_traits.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 // Tests printing::Emf serialization. | 195 // Tests printing::Emf serialization. |
| 196 // TODO(sanjeevr): Make this test meaningful for non-Windows platforms. We | 196 // TODO(sanjeevr): Make this test meaningful for non-Windows platforms. We |
| 197 // need to initialize the metafile using alternate means on the other OSes. | 197 // need to initialize the metafile using alternate means on the other OSes. |
| 198 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
| 199 TEST(IPCMessageTest, Metafile) { | 199 TEST(IPCMessageTest, Metafile) { |
| 200 scoped_ptr<printing::NativeMetafile> metafile( | 200 scoped_ptr<printing::NativeMetafile> metafile( |
| 201 printing::NativeMetafileFactory::Create()); | 201 printing::NativeMetafileFactory::Create()); |
| 202 RECT test_rect = {0, 0, 100, 100}; | 202 RECT test_rect = {0, 0, 100, 100}; |
| 203 // Create a metafile using the screen DC as a reference. | 203 // Create a metafile using the screen DC as a reference. |
| 204 metafile->CreateDc(NULL, NULL); | 204 metafile->Init(); |
| 205 metafile->FinishDocument(); | 205 metafile->FinishDocument(); |
| 206 | 206 |
| 207 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 207 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 208 IPC::ParamTraits<printing::NativeMetafile>::Write(&msg, *metafile); | 208 IPC::ParamTraits<printing::NativeMetafile>::Write(&msg, *metafile); |
| 209 | 209 |
| 210 scoped_ptr<printing::NativeMetafile> output( | 210 scoped_ptr<printing::NativeMetafile> output( |
| 211 printing::NativeMetafileFactory::Create()); | 211 printing::NativeMetafileFactory::Create()); |
| 212 void* iter = NULL; | 212 void* iter = NULL; |
| 213 EXPECT_TRUE(IPC::ParamTraits<printing::NativeMetafile>::Read( | 213 EXPECT_TRUE(IPC::ParamTraits<printing::NativeMetafile>::Read( |
| 214 &msg, &iter, output.get())); | 214 &msg, &iter, output.get())); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 262 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 263 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); | 263 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); |
| 264 | 264 |
| 265 net::HostPortPair output; | 265 net::HostPortPair output; |
| 266 void* iter = NULL; | 266 void* iter = NULL; |
| 267 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); | 267 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); |
| 268 EXPECT_EQ(input.host(), output.host()); | 268 EXPECT_EQ(input.host(), output.host()); |
| 269 EXPECT_EQ(input.port(), output.port()); | 269 EXPECT_EQ(input.port(), output.port()); |
| 270 } | 270 } |
| OLD | NEW |