| 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 "remoting/protocol/clipboard_filter.h" | 5 #include "remoting/protocol/clipboard_filter.h" |
| 6 | 6 |
| 7 #include "remoting/proto/event.pb.h" | 7 #include "remoting/proto/event.pb.h" |
| 8 #include "remoting/protocol/protocol_mock_objects.h" | 8 #include "remoting/protocol/protocol_mock_objects.h" |
| 9 #include "remoting/protocol/test_event_matchers.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 using ::testing::_; | 13 using ::testing::_; |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 namespace protocol { | 16 namespace protocol { |
| 16 | 17 |
| 17 MATCHER_P2(EqualsClipboardEvent, mime_type, data, "") { | 18 using test::EqualsClipboardEvent; |
| 18 return arg.mime_type() == mime_type && arg.data() == data; | |
| 19 } | |
| 20 | 19 |
| 21 static ClipboardEvent MakeClipboardEvent(const std::string& mime_type, | 20 static ClipboardEvent MakeClipboardEvent(const std::string& mime_type, |
| 22 const std::string& data) { | 21 const std::string& data) { |
| 23 ClipboardEvent event; | 22 ClipboardEvent event; |
| 24 event.set_mime_type(mime_type); | 23 event.set_mime_type(mime_type); |
| 25 event.set_data(data); | 24 event.set_data(data); |
| 26 return event; | 25 return event; |
| 27 } | 26 } |
| 28 | 27 |
| 29 // Verify that the filter passes events on correctly to a configured stub. | 28 // Verify that the filter passes events on correctly to a configured stub. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 51 | 50 |
| 52 // Verify that the filter ignores events if not configured. | 51 // Verify that the filter ignores events if not configured. |
| 53 TEST(ClipboardFilterTest, IgnoreEventsIfNotConfigured) { | 52 TEST(ClipboardFilterTest, IgnoreEventsIfNotConfigured) { |
| 54 ClipboardFilter clipboard_filter; | 53 ClipboardFilter clipboard_filter; |
| 55 | 54 |
| 56 clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo")); | 55 clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo")); |
| 57 } | 56 } |
| 58 | 57 |
| 59 } // namespace protocol | 58 } // namespace protocol |
| 60 } // namespace remoting | 59 } // namespace remoting |
| OLD | NEW |