summaryrefslogtreecommitdiffstats
path: root/chromium/extensions/common/warnings_test_util.cc
blob: 4060abc089cdd26368f3b8778584e5c4ac0fe52e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/common/warnings_test_util.h"

#include "base/memory/scoped_refptr.h"
#include "extensions/common/extension.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace extensions::warnings_test_util {

bool HasInstallWarning(scoped_refptr<Extension> extension,
                       const std::string& expected_message) {
  return base::ranges::count_if(
             extension->install_warnings(),
             [expected_message](const InstallWarning& warning) {
               return warning.message == expected_message;
             }) == 1;
}

}  // namespace extensions::warnings_test_util