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 "content/browser/renderer_host/pepper/pepper_printing_host.h" |
| 6 |
5 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
6 | 9 |
7 #include "base/macros.h" | 10 #include "base/macros.h" |
8 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" | 11 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" |
9 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
10 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | |
11 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
12 #include "ppapi/host/host_message_context.h" | 14 #include "ppapi/host/host_message_context.h" |
13 #include "ppapi/host/ppapi_host.h" | 15 #include "ppapi/host/ppapi_host.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
15 #include "ppapi/proxy/resource_message_params.h" | 17 #include "ppapi/proxy/resource_message_params.h" |
16 #include "ppapi/proxy/resource_message_test_sink.h" | 18 #include "ppapi/proxy/resource_message_test_sink.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 | 22 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 200, | 77 200, |
76 PP_PRINTORIENTATION_NORMAL, | 78 PP_PRINTORIENTATION_NORMAL, |
77 PP_PRINTSCALINGOPTION_NONE, | 79 PP_PRINTSCALINGOPTION_NONE, |
78 PP_FALSE, | 80 PP_FALSE, |
79 PP_PRINTOUTPUTFORMAT_PDF}; | 81 PP_PRINTOUTPUTFORMAT_PDF}; |
80 | 82 |
81 // Construct the resource host. | 83 // Construct the resource host. |
82 scoped_ptr<PepperPrintSettingsManager> manager( | 84 scoped_ptr<PepperPrintSettingsManager> manager( |
83 new MockPepperPrintSettingsManager(expected_settings)); | 85 new MockPepperPrintSettingsManager(expected_settings)); |
84 PepperPrintingHost printing(GetBrowserPpapiHost()->GetPpapiHost(), | 86 PepperPrintingHost printing(GetBrowserPpapiHost()->GetPpapiHost(), |
85 pp_instance, | 87 pp_instance, pp_resource, std::move(manager)); |
86 pp_resource, | |
87 manager.Pass()); | |
88 | 88 |
89 // Simulate a message being received. | 89 // Simulate a message being received. |
90 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 1); | 90 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 1); |
91 ppapi::host::HostMessageContext context(call_params); | 91 ppapi::host::HostMessageContext context(call_params); |
92 int32_t result = printing.OnResourceMessageReceived( | 92 int32_t result = printing.OnResourceMessageReceived( |
93 PpapiHostMsg_Printing_GetDefaultPrintSettings(), &context); | 93 PpapiHostMsg_Printing_GetDefaultPrintSettings(), &context); |
94 EXPECT_EQ(PP_OK_COMPLETIONPENDING, result); | 94 EXPECT_EQ(PP_OK_COMPLETIONPENDING, result); |
95 | 95 |
96 // This should have sent the Pepper reply to our test sink. | 96 // This should have sent the Pepper reply to our test sink. |
97 ppapi::proxy::ResourceMessageReplyParams reply_params; | 97 ppapi::proxy::ResourceMessageReplyParams reply_params; |
(...skipping 20 matching lines...) Expand all Loading... |
118 PP_SizeEqual(expected_settings.paper_size, actual_settings.paper_size)); | 118 PP_SizeEqual(expected_settings.paper_size, actual_settings.paper_size)); |
119 EXPECT_EQ(expected_settings.dpi, actual_settings.dpi); | 119 EXPECT_EQ(expected_settings.dpi, actual_settings.dpi); |
120 EXPECT_EQ(expected_settings.orientation, actual_settings.orientation); | 120 EXPECT_EQ(expected_settings.orientation, actual_settings.orientation); |
121 EXPECT_EQ(expected_settings.print_scaling_option, | 121 EXPECT_EQ(expected_settings.print_scaling_option, |
122 actual_settings.print_scaling_option); | 122 actual_settings.print_scaling_option); |
123 EXPECT_EQ(expected_settings.grayscale, actual_settings.grayscale); | 123 EXPECT_EQ(expected_settings.grayscale, actual_settings.grayscale); |
124 EXPECT_EQ(expected_settings.format, actual_settings.format); | 124 EXPECT_EQ(expected_settings.format, actual_settings.format); |
125 } | 125 } |
126 | 126 |
127 } // namespace content | 127 } // namespace content |
OLD | NEW |