Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_UPDATER_UNITTEST_UTIL_H_ |
| 6 | #define CHROME_UPDATER_UNITTEST_UTIL_H_ |
| 7 | |
| 8 | #include <ostream> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/optional.h" |
| 12 | #include "chrome/updater/tag.h" |
Sorin Jianu | cd492c4 | 2020-06-25 14:50:03 | [diff] [blame] | 13 | #include "chrome/updater/update_service.h" |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 14 | |
| 15 | // Externally-defined printers for base types. |
| 16 | namespace base { |
| 17 | |
| 18 | template <class T> |
| 19 | std::ostream& operator<<(std::ostream& os, const base::Optional<T>& opt) { |
| 20 | if (opt.has_value()) { |
| 21 | return os << opt.value(); |
| 22 | } else { |
| 23 | return os << "base::nullopt"; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | } // namespace base |
| 28 | |
| 29 | // Externally-defined printers for chrome/updater-related types. |
| 30 | namespace updater { |
| 31 | |
| 32 | namespace tagging { |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 33 | std::ostream& operator<<(std::ostream&, const ErrorCode&); |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 34 | std::ostream& operator<<(std::ostream&, const AppArgs::NeedsAdmin&); |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 35 | std::ostream& operator<<(std::ostream&, const TagArgs::BrowserType&); |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 36 | } // namespace tagging |
| 37 | |
Sorin Jianu | cd492c4 | 2020-06-25 14:50:03 | [diff] [blame] | 38 | bool operator==(const UpdateService::UpdateState& lhs, |
| 39 | const UpdateService::UpdateState& rhs); |
| 40 | inline bool operator!=(const UpdateService::UpdateState& lhs, |
| 41 | const UpdateService::UpdateState& rhs) { |
| 42 | return !(lhs == rhs); |
| 43 | } |
| 44 | |
| 45 | std::ostream& operator<<(std::ostream& os, |
| 46 | const UpdateService::UpdateState& update_state); |
| 47 | |
Michael Tang | cbc6181 | 2020-04-03 23:14:06 | [diff] [blame] | 48 | } // namespace updater |
| 49 | |
| 50 | #endif // CHROME_UPDATER_UNITTEST_UTIL_H_ |