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 #include "extensions/browser/api/cast_channel/cast_framer.h" | 5 #include "extensions/browser/api/cast_channel/cast_framer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 10 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 namespace core_api { | 14 namespace api { |
15 namespace cast_channel { | 15 namespace cast_channel { |
16 class CastFramerTest : public testing::Test { | 16 class CastFramerTest : public testing::Test { |
17 public: | 17 public: |
18 CastFramerTest() {} | 18 CastFramerTest() {} |
19 ~CastFramerTest() override {} | 19 ~CastFramerTest() override {} |
20 | 20 |
21 void SetUp() override { | 21 void SetUp() override { |
22 cast_message_.set_protocol_version(CastMessage::CASTV2_1_0); | 22 cast_message_.set_protocol_version(CastMessage::CASTV2_1_0); |
23 cast_message_.set_source_id("source"); | 23 cast_message_.set_source_id("source"); |
24 cast_message_.set_destination_id("destination"); | 24 cast_message_.set_destination_id("destination"); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, error); | 127 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, error); |
128 EXPECT_EQ(cast_message_str_.size() - 4, framer_->BytesRequested()); | 128 EXPECT_EQ(cast_message_str_.size() - 4, framer_->BytesRequested()); |
129 | 129 |
130 // Send body, expect an error. | 130 // Send body, expect an error. |
131 scoped_ptr<CastMessage> message; | 131 scoped_ptr<CastMessage> message; |
132 EXPECT_EQ(nullptr, framer_->Ingest(framer_->BytesRequested(), &message_length, | 132 EXPECT_EQ(nullptr, framer_->Ingest(framer_->BytesRequested(), &message_length, |
133 &error).get()); | 133 &error).get()); |
134 EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, error); | 134 EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, error); |
135 } | 135 } |
136 } // namespace cast_channel | 136 } // namespace cast_channel |
137 } // namespace core_api | 137 } // namespace api |
138 } // namespace extensions | 138 } // namespace extensions |
OLD | NEW |