| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Utilities for testing. | 5 // Utilities for testing. |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "ceee/testing/utils/test_utils.h" | 10 #include "ceee/testing/utils/test_utils.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 CHECK(NULL != conn.pUnk); | 51 CHECK(NULL != conn.pUnk); |
| 52 conn.pUnk->Release(); | 52 conn.pUnk->Release(); |
| 53 | 53 |
| 54 (*num_connections)++; | 54 (*num_connections)++; |
| 55 } | 55 } |
| 56 NOTREACHED(); | 56 NOTREACHED(); |
| 57 return E_UNEXPECTED; | 57 return E_UNEXPECTED; |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 bool LogDisabler::DropMessageHandler(int severity, const std::string& str) { |
| 62 return true; |
| 63 } |
| 64 |
| 61 LogDisabler::LogDisabler() { | 65 LogDisabler::LogDisabler() { |
| 62 initial_log_level_ = logging::GetMinLogLevel(); | 66 old_handler_ = logging::GetLogMessageHandler(); |
| 63 logging::SetMinLogLevel(logging::LOG_FATAL + 1); | 67 logging::SetLogMessageHandler(DropMessageHandler); |
| 64 } | 68 } |
| 65 | 69 |
| 66 LogDisabler::~LogDisabler() { | 70 LogDisabler::~LogDisabler() { |
| 67 logging::SetMinLogLevel(initial_log_level_); | 71 logging::SetLogMessageHandler(old_handler_); |
| 68 } | 72 } |
| 69 | 73 |
| 70 PathServiceOverrider::PathServiceOverrider(int key, const FilePath& path) { | 74 PathServiceOverrider::PathServiceOverrider(int key, const FilePath& path) { |
| 71 key_ = key; | 75 key_ = key; |
| 72 PathService::Get(key, &original_path_); | 76 PathService::Get(key, &original_path_); |
| 73 PathService::Override(key, path); | 77 PathService::Override(key, path); |
| 74 } | 78 } |
| 75 | 79 |
| 76 PathServiceOverrider::~PathServiceOverrider() { | 80 PathServiceOverrider::~PathServiceOverrider() { |
| 77 PathService::Override(key_, original_path_); | 81 PathService::Override(key_, original_path_); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 << WideToUTF8(std::wstring(copy.bstrVal, ::SysStringLen(copy.bstrVal))) | 165 << WideToUTF8(std::wstring(copy.bstrVal, ::SysStringLen(copy.bstrVal))) |
| 162 << "\""; | 166 << "\""; |
| 163 } | 167 } |
| 164 | 168 |
| 165 *os << "}"; | 169 *os << "}"; |
| 166 } | 170 } |
| 167 | 171 |
| 168 } // namespace testing::internal | 172 } // namespace testing::internal |
| 169 | 173 |
| 170 } // namespace testing | 174 } // namespace testing |
| OLD | NEW |