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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/test/test_mock_time_task_runner.h" | 9 #include "base/test/test_mock_time_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "blimp/common/create_blimp_message.h" | 11 #include "blimp/common/create_blimp_message.h" |
12 #include "blimp/common/proto/blimp_message.pb.h" | 12 #include "blimp/common/proto/blimp_message.pb.h" |
13 #include "blimp/net/blimp_connection.h" | 13 #include "blimp/net/blimp_connection.h" |
14 #include "blimp/net/blimp_transport.h" | 14 #include "blimp/net/blimp_transport.h" |
15 #include "blimp/net/common.h" | 15 #include "blimp/net/common.h" |
16 #include "blimp/net/connection_error_observer.h" | 16 #include "blimp/net/connection_error_observer.h" |
17 #include "blimp/net/engine_authentication_handler.h" | 17 #include "blimp/net/engine_authentication_handler.h" |
18 #include "blimp/net/test_common.h" | 18 #include "blimp/net/test_common.h" |
19 #include "net/base/completion_callback.h" | 19 #include "net/base/completion_callback.h" |
20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
21 #include "net/base/test_completion_callback.h" | 21 #include "net/base/test_completion_callback.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 using testing::_; | 25 using testing::_; |
26 using testing::Eq; | 26 using testing::Eq; |
27 using testing::SaveArg; | 27 using testing::SaveArg; |
28 | 28 |
29 namespace blimp { | 29 namespace blimp { |
30 namespace { | 30 namespace { |
31 static const std::string client_token = "valid token"; | 31 const char client_token[] = "valid token"; |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 class EngineAuthenticationHandlerTest : public testing::Test { | 34 class EngineAuthenticationHandlerTest : public testing::Test { |
35 public: | 35 public: |
36 EngineAuthenticationHandlerTest() | 36 EngineAuthenticationHandlerTest() |
37 : runner_(new base::TestMockTimeTaskRunner), | 37 : runner_(new base::TestMockTimeTaskRunner), |
38 runner_handle_(runner_), | 38 runner_handle_(runner_), |
39 auth_handler_(new EngineAuthenticationHandler(&connection_handler_, | 39 auth_handler_(new EngineAuthenticationHandler(&connection_handler_, |
40 client_token)), | 40 client_token)), |
41 connection_(new testing::StrictMock<MockBlimpConnection>()) {} | 41 connection_(new testing::StrictMock<MockBlimpConnection>()) {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 std::unique_ptr<BlimpMessage> blimp_message = | 125 std::unique_ptr<BlimpMessage> blimp_message = |
126 CreateStartConnectionMessage(client_token, 0); | 126 CreateStartConnectionMessage(client_token, 0); |
127 net::TestCompletionCallback process_message_cb; | 127 net::TestCompletionCallback process_message_cb; |
128 incoming_message_processor_->ProcessMessage(std::move(blimp_message), | 128 incoming_message_processor_->ProcessMessage(std::move(blimp_message), |
129 process_message_cb.callback()); | 129 process_message_cb.callback()); |
130 EXPECT_EQ(net::OK, process_message_cb.WaitForResult()); | 130 EXPECT_EQ(net::OK, process_message_cb.WaitForResult()); |
131 } | 131 } |
132 | 132 |
133 } // namespace blimp | 133 } // namespace blimp |
OLD | NEW |