android_webview
apps
ash
base
build
build_overrides
buildtools
cc
chrome
chromecast
chromeos
clank
codelabs
components
content
crypto
dbus
device
docs
extensions
fuchsia_web
gin
google_apis
build
calendar
classroom
common
drive
gaia
gcm
internal
tasks
test
youtube_music
BUILD.gn
DEPS
DIR_METADATA
OWNERS
credentials_mode.cc
credentials_mode.h
google_api_keys-inc.cc
google_api_keys.h
google_api_keys.py
google_api_keys_mac.h
google_api_keys_mac.mm
google_api_keys_mac_unittest.mm
google_api_keys_unittest.cc
google_api_keys_unittest.h
google_api_keys_utils.cc
google_api_keys_utils.h
run_all_unittests.cc
google_update
gpu
headless
infra
internal
ios
ios_internal
ipc
media
mojo
native_client
native_client_sdk
net
pdf
ppapi
printing
remoting
rlz
sandbox
services
signing_keys
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
v8
webkit
.clang-format
.clang-tidy
.clangd
.eslintrc.js
.git-blame-ignore-revs
.gitallowed
.gitattributes
.gitignore
.gitmodules
.gn
.mailmap
.rustfmt.toml
.vpython3
.yapfignore
ATL_OWNERS
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
CPPLINT.cfg
CRYPTO_OWNERS
DEPS
DIR_METADATA
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings

The methodology used to generate this CL is documented in https://crbug.com/1098010#c34. No-Try: true Bug: 1098010 Change-Id: I1fb879b19400429688d232eb0b8c7f96c1c3318c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3894203 Auto-Submit: Avi Drissman <avi@chromium.org> Owners-Override: Avi Drissman <avi@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1046547}
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
// Copyright 2016 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_
|
|
#define GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "base/environment.h"
|
|
#include "google_apis/google_api_keys.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
struct EnvironmentCache {
|
|
EnvironmentCache() : variable_name(nullptr), was_set(false) {}
|
|
|
|
const char* variable_name;
|
|
bool was_set;
|
|
std::string value;
|
|
};
|
|
|
|
class GoogleAPIKeysTest : public testing::Test {
|
|
public:
|
|
GoogleAPIKeysTest();
|
|
~GoogleAPIKeysTest() override;
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
|
|
private:
|
|
std::unique_ptr<base::Environment> env_;
|
|
|
|
// Why 3? It is for GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID and
|
|
// GOOGLE_DEFAULT_CLIENT_SECRET.
|
|
//
|
|
// Why 2 times CLIENT_NUM_ITEMS? This is the number of different
|
|
// clients in the OAuth2Client enumeration, and for each of these we
|
|
// have both an ID and a secret.
|
|
EnvironmentCache env_cache_[3 + 2 * google_apis::CLIENT_NUM_ITEMS];
|
|
};
|
|
|
|
#endif // GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_
|