Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: ppapi/proxy/printing_resource_unittest.cc

Issue 12504007: Revert 186925 since it breaks many of the builds on the bots (e.g. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy_unittest.cc ('k') | ppapi/proxy/websocket_resource_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <cstring> 5 #include <cstring>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "ppapi/c/dev/ppb_printing_dev.h" 8 #include "ppapi/c/dev/ppb_printing_dev.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/locking_resource_releaser.h"
11 #include "ppapi/proxy/printing_resource.h" 10 #include "ppapi/proxy/printing_resource.h"
12 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
13 #include "ppapi/proxy/ppapi_proxy_test.h" 12 #include "ppapi/proxy/ppapi_proxy_test.h"
14 #include "ppapi/thunk/thunk.h" 13 #include "ppapi/thunk/thunk.h"
14 #include "ppapi/shared_impl/scoped_pp_resource.h"
15 15
16 namespace ppapi { 16 namespace ppapi {
17 namespace proxy { 17 namespace proxy {
18 18
19 namespace { 19 namespace {
20 20
21 typedef PluginProxyTest PrintingResourceTest; 21 typedef PluginProxyTest PrintingResourceTest;
22 22
23 bool g_callback_called; 23 bool g_callback_called;
24 int32_t g_callback_result; 24 int32_t g_callback_result;
(...skipping 15 matching lines...) Expand all
40 40
41 } // namespace 41 } // namespace
42 42
43 // Does a full test of GetDefaultPrintSettings() and reply functionality in the 43 // Does a full test of GetDefaultPrintSettings() and reply functionality in the
44 // plugin side using the public C interfaces. 44 // plugin side using the public C interfaces.
45 TEST_F(PrintingResourceTest, GetDefaultPrintSettings) { 45 TEST_F(PrintingResourceTest, GetDefaultPrintSettings) {
46 g_callback_called = false; 46 g_callback_called = false;
47 47
48 const PPB_Printing_Dev_0_7* printing_iface = 48 const PPB_Printing_Dev_0_7* printing_iface =
49 thunk::GetPPB_Printing_Dev_0_7_Thunk(); 49 thunk::GetPPB_Printing_Dev_0_7_Thunk();
50 LockingResourceReleaser res(printing_iface->Create(pp_instance())); 50 ScopedPPResource res(ScopedPPResource::PassRef(),
51 printing_iface->Create(pp_instance()));
51 52
52 PP_PrintSettings_Dev output_settings; 53 PP_PrintSettings_Dev output_settings;
53 54
54 int32_t result = printing_iface->GetDefaultPrintSettings( 55 int32_t result = printing_iface->GetDefaultPrintSettings(
55 res.get(), &output_settings, PP_MakeCompletionCallback(&Callback, NULL)); 56 res, &output_settings, PP_MakeCompletionCallback(&Callback, NULL));
56 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); 57 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
57 58
58 // Should have sent a "GetDefaultPrintSettings" message. 59 // Should have sent a "GetDefaultPrintSettings" message.
59 ResourceMessageCallParams params; 60 ResourceMessageCallParams params;
60 IPC::Message msg; 61 IPC::Message msg;
61 ASSERT_TRUE(sink().GetFirstResourceCallMatching( 62 ASSERT_TRUE(sink().GetFirstResourceCallMatching(
62 PpapiHostMsg_Printing_GetDefaultPrintSettings::ID, &params, &msg)); 63 PpapiHostMsg_Printing_GetDefaultPrintSettings::ID, &params, &msg));
63 64
64 // Synthesize a response with some random print settings. 65 // Synthesize a response with some random print settings.
65 ResourceMessageReplyParams reply_params(params.pp_resource(), 66 ResourceMessageReplyParams reply_params(params.pp_resource(),
(...skipping 27 matching lines...) Expand all
93 output_settings.print_scaling_option); 94 output_settings.print_scaling_option);
94 EXPECT_EQ(reply_settings.grayscale, output_settings.grayscale); 95 EXPECT_EQ(reply_settings.grayscale, output_settings.grayscale);
95 EXPECT_EQ(reply_settings.format, output_settings.format); 96 EXPECT_EQ(reply_settings.format, output_settings.format);
96 97
97 EXPECT_EQ(g_callback_result, PP_OK); 98 EXPECT_EQ(g_callback_result, PP_OK);
98 EXPECT_EQ(g_callback_called, true); 99 EXPECT_EQ(g_callback_called, true);
99 } 100 }
100 101
101 } // namespace proxy 102 } // namespace proxy
102 } // namespace ppapi 103 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy_unittest.cc ('k') | ppapi/proxy/websocket_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698