blob: 33b013f5f61ce046315538691ff1650c49f8b7f2 [file] [log] [blame]
Michael Tangcbc61812020-04-03 23:14:061// 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 Jianucd492c42020-06-25 14:50:0313#include "chrome/updater/update_service.h"
Michael Tangcbc61812020-04-03 23:14:0614
15// Externally-defined printers for base types.
16namespace base {
17
18template <class T>
19std::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.
30namespace updater {
31
32namespace tagging {
Michael Tangcbc61812020-04-03 23:14:0633std::ostream& operator<<(std::ostream&, const ErrorCode&);
Michael Tangcbc61812020-04-03 23:14:0634std::ostream& operator<<(std::ostream&, const AppArgs::NeedsAdmin&);
Michael Tangcbc61812020-04-03 23:14:0635std::ostream& operator<<(std::ostream&, const TagArgs::BrowserType&);
Michael Tangcbc61812020-04-03 23:14:0636} // namespace tagging
37
Sorin Jianucd492c42020-06-25 14:50:0338bool operator==(const UpdateService::UpdateState& lhs,
39 const UpdateService::UpdateState& rhs);
40inline bool operator!=(const UpdateService::UpdateState& lhs,
41 const UpdateService::UpdateState& rhs) {
42 return !(lhs == rhs);
43}
44
45std::ostream& operator<<(std::ostream& os,
46 const UpdateService::UpdateState& update_state);
47
Michael Tangcbc61812020-04-03 23:14:0648} // namespace updater
49
50#endif // CHROME_UPDATER_UNITTEST_UTIL_H_