OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ipc/attachment_broker.h" | 10 #include "ipc/attachment_broker.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 BrokerableType GetBrokerableType() const override { return WIN_HANDLE; } | 35 BrokerableType GetBrokerableType() const override { return WIN_HANDLE; } |
36 | 36 |
37 private: | 37 private: |
38 ~MockAttachment() override {} | 38 ~MockAttachment() override {} |
39 }; | 39 }; |
40 | 40 |
41 class MockAttachmentBroker : public AttachmentBroker { | 41 class MockAttachmentBroker : public AttachmentBroker { |
42 public: | 42 public: |
43 typedef std::set<scoped_refptr<BrokerableAttachment>> AttachmentSet; | 43 typedef std::set<scoped_refptr<BrokerableAttachment>> AttachmentSet; |
44 | 44 |
45 bool SendAttachmentToProcess(const BrokerableAttachment* attachment, | 45 bool SendAttachmentToProcess(BrokerableAttachment* attachment, |
46 base::ProcessId destination_process) override { | 46 base::ProcessId destination_process) override { |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 bool OnMessageReceived(const Message& message) override { return false; } | 50 bool OnMessageReceived(const Message& message) override { return false; } |
51 | 51 |
52 void AddAttachment(scoped_refptr<BrokerableAttachment> attachment) { | 52 void AddAttachment(scoped_refptr<BrokerableAttachment> attachment) { |
53 get_attachments()->push_back(attachment); | 53 get_attachments()->push_back(attachment); |
54 NotifyObservers(attachment->GetIdentifier()); | 54 NotifyObservers(attachment->GetIdentifier()); |
55 } | 55 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 header.payload_size = std::numeric_limits<int32_t>::max(); | 186 header.payload_size = std::numeric_limits<int32_t>::max(); |
187 EXPECT_FALSE(reader.TranslateInputData( | 187 EXPECT_FALSE(reader.TranslateInputData( |
188 reinterpret_cast<const char*>(&header), sizeof(header))); | 188 reinterpret_cast<const char*>(&header), sizeof(header))); |
189 EXPECT_LE(reader.input_overflow_buf_.capacity(), capacity_before); | 189 EXPECT_LE(reader.input_overflow_buf_.capacity(), capacity_before); |
190 } | 190 } |
191 | 191 |
192 #endif // !USE_ATTACHMENT_BROKER | 192 #endif // !USE_ATTACHMENT_BROKER |
193 | 193 |
194 } // namespace internal | 194 } // namespace internal |
195 } // namespace IPC | 195 } // namespace IPC |
OLD | NEW |