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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include <string> | 8 #include <string> |
6 | 9 |
7 #include "base/test/simple_test_clock.h" | 10 #include "base/test/simple_test_clock.h" |
8 #include "extensions/browser/api/cast_channel/cast_auth_util.h" | 11 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
9 #include "extensions/browser/api/cast_channel/logger.h" | 12 #include "extensions/browser/api/cast_channel/logger.h" |
10 #include "extensions/browser/api/cast_channel/logger_util.h" | 13 #include "extensions/browser/api/cast_channel/logger_util.h" |
11 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/zlib/zlib.h" | 16 #include "third_party/zlib/zlib.h" |
14 | 17 |
(...skipping 10 matching lines...) Expand all Loading... |
25 public: | 28 public: |
26 // |logger_| will take ownership of |clock_|. | 29 // |logger_| will take ownership of |clock_|. |
27 CastChannelLoggerTest() | 30 CastChannelLoggerTest() |
28 : clock_(new base::SimpleTestClock), | 31 : clock_(new base::SimpleTestClock), |
29 logger_(new Logger(scoped_ptr<base::Clock>(clock_), base::Time())) {} | 32 logger_(new Logger(scoped_ptr<base::Clock>(clock_), base::Time())) {} |
30 ~CastChannelLoggerTest() override {} | 33 ~CastChannelLoggerTest() override {} |
31 | 34 |
32 bool Uncompress(const char* input, int length, std::string* output) { | 35 bool Uncompress(const char* input, int length, std::string* output) { |
33 z_stream stream = {0}; | 36 z_stream stream = {0}; |
34 | 37 |
35 stream.next_in = reinterpret_cast<uint8*>(const_cast<char*>(input)); | 38 stream.next_in = reinterpret_cast<uint8_t*>(const_cast<char*>(input)); |
36 stream.avail_in = length; | 39 stream.avail_in = length; |
37 stream.next_out = reinterpret_cast<uint8*>(&(*output)[0]); | 40 stream.next_out = reinterpret_cast<uint8_t*>(&(*output)[0]); |
38 stream.avail_out = output->size(); | 41 stream.avail_out = output->size(); |
39 | 42 |
40 bool success = false; | 43 bool success = false; |
41 while (stream.avail_in > 0 && stream.avail_out > 0) { | 44 while (stream.avail_in > 0 && stream.avail_out > 0) { |
42 // 16 is added to read in gzip format. | 45 // 16 is added to read in gzip format. |
43 int result = inflateInit2(&stream, MAX_WBITS + 16); | 46 int result = inflateInit2(&stream, MAX_WBITS + 16); |
44 DCHECK_EQ(Z_OK, result); | 47 DCHECK_EQ(Z_OK, result); |
45 | 48 |
46 result = inflate(&stream, Z_FINISH); | 49 result = inflate(&stream, Z_FINISH); |
47 success = (result == Z_STREAM_END); | 50 success = (result == Z_STREAM_END); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 317 |
315 log = GetLog(); | 318 log = GetLog(); |
316 ASSERT_TRUE(log); | 319 ASSERT_TRUE(log); |
317 | 320 |
318 EXPECT_EQ(0, log->aggregated_socket_event_size()); | 321 EXPECT_EQ(0, log->aggregated_socket_event_size()); |
319 } | 322 } |
320 | 323 |
321 } // namespace cast_channel | 324 } // namespace cast_channel |
322 } // namespace api | 325 } // namespace api |
323 } // namespace extensions | 326 } // namespace extensions |
OLD | NEW |