Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_ | |
| 6 #define GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/environment.h" | |
| 12 #include "google_apis/google_api_keys.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 | |
| 15 struct EnvironmentCache { | |
| 16 public: | |
|
Robert Sesek
2016/08/10 15:04:16
structs are public by default
bzanotti
2016/08/10 16:24:59
Done.
| |
| 17 EnvironmentCache() : variable_name(NULL), was_set(false) {} | |
|
Robert Sesek
2016/08/10 15:04:16
NULL -> nullptr
bzanotti
2016/08/10 16:24:59
Done.
| |
| 18 | |
| 19 const char* variable_name; | |
| 20 bool was_set; | |
| 21 std::string value; | |
| 22 }; | |
| 23 | |
| 24 class GoogleAPIKeysTest : public testing::Test { | |
| 25 public: | |
| 26 GoogleAPIKeysTest(); | |
| 27 ~GoogleAPIKeysTest() override; | |
| 28 void SetUp() override; | |
| 29 void TearDown() override; | |
| 30 | |
| 31 private: | |
| 32 std::unique_ptr<base::Environment> env_; | |
| 33 | |
| 34 // Why 3? It is for GOOGLE_API_KEY, GOOGLE_DEFAULT_CLIENT_ID and | |
| 35 // GOOGLE_DEFAULT_CLIENT_SECRET. | |
| 36 // | |
| 37 // Why 2 times CLIENT_NUM_ITEMS? This is the number of different | |
| 38 // clients in the OAuth2Client enumeration, and for each of these we | |
| 39 // have both an ID and a secret. | |
| 40 EnvironmentCache env_cache_[3 + 2 * google_apis::CLIENT_NUM_ITEMS]; | |
| 41 }; | |
| 42 | |
| 43 #endif // GOOGLE_APIS_GOOGLE_API_KEYS_UNITTEST_H_ | |
| OLD | NEW |