| 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 return arg.mime_type() == mime_type && arg.data() == data; | |
| 19 } | |
| 20 | |
| 21 static ClipboardEvent MakeClipboardEvent(const std::string& mime_type, | 18 static ClipboardEvent MakeClipboardEvent(const std::string& mime_type, |
| 22 const std::string& data) { | 19 const std::string& data) { |
| 23 ClipboardEvent event; | 20 ClipboardEvent event; |
| 24 event.set_mime_type(mime_type); | 21 event.set_mime_type(mime_type); |
| 25 event.set_data(data); | 22 event.set_data(data); |
| 26 return event; | 23 return event; |
| 27 } | 24 } |
| 28 | 25 |
| 29 // Verify that the filter passes events on correctly to a configured stub. | 26 // Verify that the filter passes events on correctly to a configured stub. |
| 30 TEST(ClipboardFilterTest, EventsPassThroughFilter) { | 27 TEST(ClipboardFilterTest, EventsPassThroughFilter) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 | 48 |
| 52 // Verify that the filter ignores events if not configured. | 49 // Verify that the filter ignores events if not configured. |
| 53 TEST(ClipboardFilterTest, IgnoreEventsIfNotConfigured) { | 50 TEST(ClipboardFilterTest, IgnoreEventsIfNotConfigured) { |
| 54 ClipboardFilter clipboard_filter; | 51 ClipboardFilter clipboard_filter; |
| 55 | 52 |
| 56 clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo")); | 53 clipboard_filter.InjectClipboardEvent(MakeClipboardEvent("text","foo")); |
| 57 } | 54 } |
| 58 | 55 |
| 59 } // namespace protocol | 56 } // namespace protocol |
| 60 } // namespace remoting | 57 } // namespace remoting |
| OLD | NEW |