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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "extensions/browser/api/cast_channel/cast_socket.h" | 13 #include "extensions/browser/api/cast_channel/cast_socket.h" |
14 #include "extensions/browser/api/cast_channel/cast_transport.h" | 14 #include "extensions/browser/api/cast_channel/cast_transport.h" |
15 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 15 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 namespace api { | 20 namespace api { |
21 namespace cast_channel { | 21 namespace cast_channel { |
22 | 22 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 MATCHER_P(EqualsProto, message, "") { | 109 MATCHER_P(EqualsProto, message, "") { |
110 std::string expected_serialized, actual_serialized; | 110 std::string expected_serialized, actual_serialized; |
111 message.SerializeToString(&expected_serialized); | 111 message.SerializeToString(&expected_serialized); |
112 arg.SerializeToString(&actual_serialized); | 112 arg.SerializeToString(&actual_serialized); |
113 return expected_serialized == actual_serialized; | 113 return expected_serialized == actual_serialized; |
114 } | 114 } |
115 | 115 |
116 ACTION_TEMPLATE(PostCompletionCallbackTask, | 116 ACTION_TEMPLATE(PostCompletionCallbackTask, |
117 HAS_1_TEMPLATE_PARAMS(int, cb_idx), | 117 HAS_1_TEMPLATE_PARAMS(int, cb_idx), |
118 AND_1_VALUE_PARAMS(rv)) { | 118 AND_1_VALUE_PARAMS(rv)) { |
119 base::MessageLoop::current()->PostTask( | 119 base::ThreadTaskRunnerHandle::Get()->PostTask( |
120 FROM_HERE, base::Bind(testing::get<cb_idx>(args), rv)); | 120 FROM_HERE, base::Bind(testing::get<cb_idx>(args), rv)); |
121 } | 121 } |
122 | 122 |
123 } // namespace cast_channel | 123 } // namespace cast_channel |
124 } // namespace api | 124 } // namespace api |
125 } // namespace extensions | 125 } // namespace extensions |
126 | 126 |
127 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ | 127 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ |
OLD | NEW |