OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ | 5 #ifndef COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ |
6 #define COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ | 6 #define COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 13 matching lines...) Expand all Loading... |
24 struct PrintHostMsg_DidPrintPage_Params; | 24 struct PrintHostMsg_DidPrintPage_Params; |
25 | 25 |
26 // A class which represents an output page used in the MockPrinter class. | 26 // A class which represents an output page used in the MockPrinter class. |
27 // The MockPrinter class stores output pages in a vector, so, this class | 27 // The MockPrinter class stores output pages in a vector, so, this class |
28 // inherits the base::RefCounted<> class so that the MockPrinter class can use | 28 // inherits the base::RefCounted<> class so that the MockPrinter class can use |
29 // a smart pointer of this object (i.e. scoped_refptr<>). | 29 // a smart pointer of this object (i.e. scoped_refptr<>). |
30 class MockPrinterPage : public base::RefCounted<MockPrinterPage> { | 30 class MockPrinterPage : public base::RefCounted<MockPrinterPage> { |
31 public: | 31 public: |
32 MockPrinterPage(const void* source_data, | 32 MockPrinterPage(const void* source_data, |
33 uint32_t source_size, | 33 uint32_t source_size, |
34 const printing::Image& image); | 34 printing::Image image); |
35 | 35 |
36 int width() const { return image_.size().width(); } | 36 int width() const { return image_.size().width(); } |
37 int height() const { return image_.size().height(); } | 37 int height() const { return image_.size().height(); } |
38 const uint8_t* source_data() const { return source_data_.get(); } | 38 const uint8_t* source_data() const { return source_data_.get(); } |
39 uint32_t source_size() const { return source_size_; } | 39 uint32_t source_size() const { return source_size_; } |
40 const printing::Image& image() const { return image_; } | 40 const printing::Image& image() const { return image_; } |
41 | 41 |
42 private: | 42 private: |
43 friend class base::RefCounted<MockPrinterPage>; | 43 friend class base::RefCounted<MockPrinterPage>; |
44 virtual ~MockPrinterPage(); | 44 virtual ~MockPrinterPage(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // Used for generating invalid settings. | 158 // Used for generating invalid settings. |
159 bool use_invalid_settings_; | 159 bool use_invalid_settings_; |
160 | 160 |
161 std::vector<scoped_refptr<MockPrinterPage>> pages_; | 161 std::vector<scoped_refptr<MockPrinterPage>> pages_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(MockPrinter); | 163 DISALLOW_COPY_AND_ASSIGN(MockPrinter); |
164 }; | 164 }; |
165 | 165 |
166 #endif // COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ | 166 #endif // COMPONENTS_PRINTING_TEST_MOCK_PRINTER_H_ |
OLD | NEW |