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

Side by Side Diff: ppapi/tests/test_printing.cc

Issue 10826072: Implement browser side of PPB_Printing resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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/tests/test_printing.h ('k') | ppapi/thunk/enter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/tests/test_printing.h"
6
7 #include "ppapi/cpp/dev/printing_dev.h"
8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/tests/testing_instance.h"
10
11 namespace {
12 bool g_callback_triggered;
13 int32_t g_callback_result;
14 } // namespace
15
16 REGISTER_TEST_CASE(Printing);
17
18 class TestPrinting_Dev : public pp::Printing_Dev {
19 public:
20 explicit TestPrinting_Dev(pp::Instance* instance) :
21 pp::Printing_Dev(instance) {}
22 virtual ~TestPrinting_Dev() {}
23 virtual uint32_t QuerySupportedPrintOutputFormats() { return 0; }
24 virtual int32_t PrintBegin(
25 const PP_PrintSettings_Dev& print_settings) { return 0; }
26 virtual pp::Resource PrintPages(
27 const PP_PrintPageNumberRange_Dev* page_ranges,
28 uint32_t page_range_count) {
29 return pp::Resource();
30 }
31 virtual void PrintEnd() {}
32 virtual bool IsPrintScalingDisabled() { return false; }
33 };
34
35 TestPrinting::TestPrinting(TestingInstance* instance)
36 : TestCase(instance),
37 nested_event_(instance->pp_instance()) {
38 callback_factory_.Initialize(this);
39 }
40
41 void TestPrinting::RunTests(const std::string& filter) {
42 RUN_TEST(GetDefaultPrintSettings, filter);
43 }
44
45 std::string TestPrinting::TestGetDefaultPrintSettings() {
46 g_callback_triggered = false;
47 TestPrinting_Dev test_printing(instance_);
48 pp::CompletionCallbackWithOutput<PP_PrintSettings_Dev> cb =
49 callback_factory_.NewCallbackWithOutput(&TestPrinting::Callback);
50 test_printing.GetDefaultPrintSettings(cb);
51 nested_event_.Wait();
52
53 ASSERT_EQ(PP_OK, g_callback_result);
54 ASSERT_TRUE(g_callback_triggered);
55
56 PASS();
57 }
58
59 void TestPrinting::Callback(int32_t result,
60 PP_PrintSettings_Dev& /* unused */) {
61 g_callback_triggered = true;
62 g_callback_result = result;
63 nested_event_.Signal();
64 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_printing.h ('k') | ppapi/thunk/enter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698