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 "components/device_event_log/device_event_log_impl.h" | 5 #include "components/device_event_log/device_event_log_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/test/test_simple_task_runner.h" | 19 #include "base/test/test_simple_task_runner.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 namespace device_event_log { | 22 namespace device_event_log { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const size_t kDefaultMaxEvents = 100; | 26 const size_t kDefaultMaxEvents = 100; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 void AddEventType(LogType type, const std::string& event) { | 114 void AddEventType(LogType type, const std::string& event) { |
115 impl_->AddEntry(kFileName, 0, type, kDefaultLevel, event); | 115 impl_->AddEntry(kFileName, 0, type, kDefaultLevel, event); |
116 task_runner_->RunUntilIdle(); | 116 task_runner_->RunUntilIdle(); |
117 } | 117 } |
118 | 118 |
119 size_t GetMaxEntries() const { return impl_->max_entries(); } | 119 size_t GetMaxEntries() const { return impl_->max_entries(); } |
120 | 120 |
121 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 121 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
122 scoped_ptr<DeviceEventLogImpl> impl_; | 122 std::unique_ptr<DeviceEventLogImpl> impl_; |
123 | 123 |
124 private: | 124 private: |
125 DISALLOW_COPY_AND_ASSIGN(DeviceEventLogTest); | 125 DISALLOW_COPY_AND_ASSIGN(DeviceEventLogTest); |
126 }; | 126 }; |
127 | 127 |
128 TEST_F(DeviceEventLogTest, TestNetworkEvents) { | 128 TEST_F(DeviceEventLogTest, TestNetworkEvents) { |
129 std::string output_none = GetOrderedString(OLDEST_FIRST, 0); | 129 std::string output_none = GetOrderedString(OLDEST_FIRST, 0); |
130 EXPECT_EQ("No Log Entries.", output_none); | 130 EXPECT_EQ("No Log Entries.", output_none); |
131 | 131 |
132 LogLevel level = kDefaultLevel; | 132 LogLevel level = kDefaultLevel; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 "Power: event2\n" | 284 "Power: event2\n" |
285 "Network: event3\n" | 285 "Network: event3\n" |
286 "Power: event4\n" | 286 "Power: event4\n" |
287 "Network: event5\n" | 287 "Network: event5\n" |
288 "Network: event6\n"); | 288 "Network: event6\n"); |
289 EXPECT_EQ(all_events, GetLogStringForType("network,power")); | 289 EXPECT_EQ(all_events, GetLogStringForType("network,power")); |
290 EXPECT_EQ(all_events, GetLogStringForType("")); | 290 EXPECT_EQ(all_events, GetLogStringForType("")); |
291 } | 291 } |
292 | 292 |
293 } // namespace device_event_log | 293 } // namespace device_event_log |
OLD | NEW |