| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/network/network_event_log.h" | 5 #include "chromeos/network/network_event_log.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace network_event_log { | 17 namespace network_event_log { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 network_event_log::LogLevel kDefaultLevel = network_event_log::LOG_LEVEL_EVENT; | 21 network_event_log::LogLevel kDefaultLevel = network_event_log::LOG_LEVEL_EVENT; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 class NetworkEventLogTest : public testing::Test { | 25 class NetworkEventLogTest : public testing::Test { |
| 26 public: | 26 public: |
| 27 NetworkEventLogTest() { | 27 NetworkEventLogTest() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual void SetUp() OVERRIDE { | 30 virtual void SetUp() override { |
| 31 network_event_log::Initialize(); | 31 network_event_log::Initialize(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void TearDown() OVERRIDE { | 34 virtual void TearDown() override { |
| 35 network_event_log::Shutdown(); | 35 network_event_log::Shutdown(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 std::string SkipTime(const std::string& input) { | 39 std::string SkipTime(const std::string& input) { |
| 40 std::string output; | 40 std::string output; |
| 41 std::vector<std::string> lines; | 41 std::vector<std::string> lines; |
| 42 base::SplitString(input, '\n', &lines); | 42 base::SplitString(input, '\n', &lines); |
| 43 for (size_t i = 0; i < lines.size(); ++i) { | 43 for (size_t i = 0; i < lines.size(); ++i) { |
| 44 size_t n = lines[i].find(']'); | 44 size_t n = lines[i].find(']'); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 AddTestEvent(LOG_LEVEL_ERROR, "error3"); | 235 AddTestEvent(LOG_LEVEL_ERROR, "error3"); |
| 236 AddTestEvent(LOG_LEVEL_ERROR, "error4"); | 236 AddTestEvent(LOG_LEVEL_ERROR, "error4"); |
| 237 AddTestEvent(LOG_LEVEL_EVENT, "event5"); | 237 AddTestEvent(LOG_LEVEL_EVENT, "event5"); |
| 238 AddTestEvent(LOG_LEVEL_EVENT, "event6"); | 238 AddTestEvent(LOG_LEVEL_EVENT, "event6"); |
| 239 EXPECT_EQ("error3\nerror4\nevent5\nevent6\n", network_event_log::GetAsString( | 239 EXPECT_EQ("error3\nerror4\nevent5\nevent6\n", network_event_log::GetAsString( |
| 240 OLDEST_FIRST, "", LOG_LEVEL_DEBUG, 0)); | 240 OLDEST_FIRST, "", LOG_LEVEL_DEBUG, 0)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace network_event_log | 243 } // namespace network_event_log |
| 244 } // namespace chromeos | 244 } // namespace chromeos |
| OLD | NEW |