OLD | NEW |
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 <string.h> | 5 #include <string.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/public/common/common_param_traits.h" | 10 #include "content/public/common/common_param_traits.h" |
11 #include "content/public/common/url_utils.h" | 11 #include "content/public/common/content_constants.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
13 #include "ipc/ipc_message_utils.h" | 13 #include "ipc/ipc_message_utils.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "printing/backend/print_backend.h" | 15 #include "printing/backend/print_backend.h" |
16 #include "printing/page_range.h" | 16 #include "printing/page_range.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
20 #include "ui/gfx/ipc/gfx_param_traits.h" | 20 #include "ui/gfx/ipc/gfx_param_traits.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
46 EXPECT_EQ(input.host(), output.host()); | 46 EXPECT_EQ(input.host(), output.host()); |
47 EXPECT_EQ(input.port(), output.port()); | 47 EXPECT_EQ(input.port(), output.port()); |
48 EXPECT_EQ(input.path(), output.path()); | 48 EXPECT_EQ(input.path(), output.path()); |
49 EXPECT_EQ(input.query(), output.query()); | 49 EXPECT_EQ(input.query(), output.query()); |
50 EXPECT_EQ(input.ref(), output.ref()); | 50 EXPECT_EQ(input.ref(), output.ref()); |
51 } | 51 } |
52 | 52 |
53 // Test an excessively long GURL. | 53 // Test an excessively long GURL. |
54 { | 54 { |
55 const std::string url = std::string("http://example.org/").append( | 55 const std::string url = std::string("http://example.org/").append( |
56 content::GetMaxURLChars() + 1, 'a'); | 56 content::kMaxURLChars + 1, 'a'); |
57 GURL input(url.c_str()); | 57 GURL input(url.c_str()); |
58 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 58 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
59 IPC::ParamTraits<GURL>::Write(&msg, input); | 59 IPC::ParamTraits<GURL>::Write(&msg, input); |
60 | 60 |
61 GURL output; | 61 GURL output; |
62 base::PickleIterator iter(msg); | 62 base::PickleIterator iter(msg); |
63 EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); | 63 EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); |
64 EXPECT_TRUE(output.is_empty()); | 64 EXPECT_TRUE(output.is_empty()); |
65 } | 65 } |
66 | 66 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 200 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
201 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); | 201 IPC::ParamTraits<net::HostPortPair>::Write(&msg, input); |
202 | 202 |
203 net::HostPortPair output; | 203 net::HostPortPair output; |
204 base::PickleIterator iter(msg); | 204 base::PickleIterator iter(msg); |
205 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); | 205 EXPECT_TRUE(IPC::ParamTraits<net::HostPortPair>::Read(&msg, &iter, &output)); |
206 EXPECT_EQ(input.host(), output.host()); | 206 EXPECT_EQ(input.host(), output.host()); |
207 EXPECT_EQ(input.port(), output.port()); | 207 EXPECT_EQ(input.port(), output.port()); |
208 } | 208 } |
OLD | NEW |