| 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 "media/formats/webm/webm_webvtt_parser.h" | 5 #include "media/formats/webm/webm_webvtt_parser.h" |
| 6 #include "testing/gmock/include/gmock/gmock.h" | 6 #include "testing/gmock/include/gmock/gmock.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 using ::testing::InSequence; | 9 using ::testing::InSequence; |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 typedef std::vector<uint8> Cue; | 13 typedef std::vector<uint8_t> Cue; |
| 14 | 14 |
| 15 static Cue EncodeCue(const std::string& id, | 15 static Cue EncodeCue(const std::string& id, |
| 16 const std::string& settings, | 16 const std::string& settings, |
| 17 const std::string& content) { | 17 const std::string& content) { |
| 18 const std::string result = id + '\n' + settings + '\n' + content; | 18 const std::string result = id + '\n' + settings + '\n' + content; |
| 19 const uint8* const buf = reinterpret_cast<const uint8*>(result.data()); | 19 const uint8_t* const buf = reinterpret_cast<const uint8_t*>(result.data()); |
| 20 return Cue(buf, buf + result.length()); | 20 return Cue(buf, buf + result.length()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 static void DecodeCue(const Cue& cue, | 23 static void DecodeCue(const Cue& cue, |
| 24 std::string* id, | 24 std::string* id, |
| 25 std::string* settings, | 25 std::string* settings, |
| 26 std::string* content) { | 26 std::string* content) { |
| 27 WebMWebVTTParser::Parse(&cue[0], static_cast<int>(cue.size()), | 27 WebMWebVTTParser::Parse(&cue[0], static_cast<int>(cue.size()), |
| 28 id, settings, content); | 28 id, settings, content); |
| 29 } | 29 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 std::string id, settings, content; | 96 std::string id, settings, content; |
| 97 | 97 |
| 98 DecodeCue(cue, &id, &settings, &content); | 98 DecodeCue(cue, &id, &settings, &content); |
| 99 EXPECT_EQ(id, ""); | 99 EXPECT_EQ(id, ""); |
| 100 EXPECT_EQ(settings, ""); | 100 EXPECT_EQ(settings, ""); |
| 101 EXPECT_EQ(content, content_str[i]); | 101 EXPECT_EQ(content, content_str[i]); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace media | 105 } // namespace media |
| OLD | NEW |