OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
11 #include "chrome/renderer/media/chrome_webrtc_log_message_delegate.h" | 13 #include "chrome/renderer/media/chrome_webrtc_log_message_delegate.h" |
12 #include "chrome/renderer/media/mock_webrtc_logging_message_filter.h" | 14 #include "chrome/renderer/media/mock_webrtc_logging_message_filter.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 | 16 |
(...skipping 25 matching lines...) Expand all Loading... |
40 FROM_HERE, base::Bind(&ChromeWebRtcLogMessageDelegate::OnStopLogging, | 42 FROM_HERE, base::Bind(&ChromeWebRtcLogMessageDelegate::OnStopLogging, |
41 base::Unretained(log_message_delegate))); | 43 base::Unretained(log_message_delegate))); |
42 | 44 |
43 // This log message should not be added to the log buffer. | 45 // This log message should not be added to the log buffer. |
44 log_message_delegate->LogMessage(kTestString); | 46 log_message_delegate->LogMessage(kTestString); |
45 | 47 |
46 message_loop.RunUntilIdle(); | 48 message_loop.RunUntilIdle(); |
47 | 49 |
48 // Size is calculated as (sizeof(kTestString) - 1 for terminating null | 50 // Size is calculated as (sizeof(kTestString) - 1 for terminating null |
49 // + 1 for eol added for each log message in LogMessage) * 2. | 51 // + 1 for eol added for each log message in LogMessage) * 2. |
50 const uint32 kExpectedSize = sizeof(kTestString) * 2; | 52 const uint32_t kExpectedSize = sizeof(kTestString) * 2; |
51 EXPECT_EQ(kExpectedSize, log_message_filter->log_buffer_.size()); | 53 EXPECT_EQ(kExpectedSize, log_message_filter->log_buffer_.size()); |
52 | 54 |
53 std::string ref_output = kTestString; | 55 std::string ref_output = kTestString; |
54 ref_output.append("\n"); | 56 ref_output.append("\n"); |
55 ref_output.append(kTestString); | 57 ref_output.append(kTestString); |
56 ref_output.append("\n"); | 58 ref_output.append("\n"); |
57 EXPECT_STREQ(ref_output.c_str(), log_message_filter->log_buffer_.c_str()); | 59 EXPECT_STREQ(ref_output.c_str(), log_message_filter->log_buffer_.c_str()); |
58 } | 60 } |
OLD | NEW |