| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 // Unit tests for implementation of google_api_keys namespace. |    5 // Unit tests for implementation of google_api_keys namespace. | 
|    6 // |    6 // | 
|    7 // Because the file deals with a lot of preprocessor defines and |    7 // Because the file deals with a lot of preprocessor defines and | 
|    8 // optionally includes an internal header, the way we test is by |    8 // optionally includes an internal header, the way we test is by | 
|    9 // including the .cc file multiple times with different defines set. |    9 // including the .cc file multiple times with different defines set. | 
|   10 // This is a little unorthodox, but it lets us test the behavior as |   10 // This is a little unorthodox, but it lets us test the behavior as | 
|   11 // close to unmodified as possible. |   11 // close to unmodified as possible. | 
|   12  |   12  | 
|   13 #include "google_apis/google_api_keys.h" |   13 #include "google_apis/google_api_keys.h" | 
|   14  |   14  | 
 |   15 #include "base/macros.h" | 
|   15 #include "build/build_config.h" |   16 #include "build/build_config.h" | 
|   16 #include "google_apis/gaia/gaia_switches.h" |   17 #include "google_apis/gaia/gaia_switches.h" | 
|   17 #include "testing/gtest/include/gtest/gtest.h" |   18 #include "testing/gtest/include/gtest/gtest.h" | 
|   18  |   19  | 
|   19 // The Win builders fail (with a linker crash) when trying to link |   20 // The Win builders fail (with a linker crash) when trying to link | 
|   20 // unit_tests, and the Android builders complain about multiply |   21 // unit_tests, and the Android builders complain about multiply | 
|   21 // defined symbols (likely they don't do name decoration as well as |   22 // defined symbols (likely they don't do name decoration as well as | 
|   22 // the Mac and Linux linkers).  Therefore these tests are only built |   23 // the Mac and Linux linkers).  Therefore these tests are only built | 
|   23 // and run on Mac and Linux, which should provide plenty of coverage |   24 // and run on Mac and Linux, which should provide plenty of coverage | 
|   24 // since there are no platform-specific bits in this code. |   25 // since there are no platform-specific bits in this code. | 
|   25 #if defined(OS_LINUX) || defined(OS_MACOSX) |   26 #if defined(OS_LINUX) || defined(OS_MACOSX) | 
|   26  |   27  | 
|   27 // We need to include everything included by google_api_keys.cc once |   28 // We need to include everything included by google_api_keys.cc once | 
|   28 // at global scope so that things like STL and classes from base don't |   29 // at global scope so that things like STL and classes from base don't | 
|   29 // get defined when we re-include the google_api_keys.cc file |   30 // get defined when we re-include the google_api_keys.cc file | 
|   30 // below. We used to include that file in its entirety here, but that |   31 // below. We used to include that file in its entirety here, but that | 
|   31 // can cause problems if the linker decides the version of symbols |   32 // can cause problems if the linker decides the version of symbols | 
|   32 // from that file included here is the "right" version. |   33 // from that file included here is the "right" version. | 
 |   34  | 
 |   35 #include <stddef.h> | 
 |   36  | 
|   33 #include <string> |   37 #include <string> | 
|   34 #include "base/command_line.h" |   38 #include "base/command_line.h" | 
|   35 #include "base/environment.h" |   39 #include "base/environment.h" | 
|   36 #include "base/lazy_instance.h" |   40 #include "base/lazy_instance.h" | 
|   37 #include "base/logging.h" |   41 #include "base/logging.h" | 
|   38 #include "base/memory/scoped_ptr.h" |   42 #include "base/memory/scoped_ptr.h" | 
|   39 #include "base/strings/stringize_macros.h" |   43 #include "base/strings/stringize_macros.h" | 
|   40  |   44  | 
|   41 // This is the default baked-in value for OAuth IDs and secrets. |   45 // This is the default baked-in value for OAuth IDs and secrets. | 
|   42 static const char kDummyToken[] = "dummytoken"; |   46 static const char kDummyToken[] = "dummytoken"; | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  489   EXPECT_EQ("env-SECRET_MAIN", secret_main); |  493   EXPECT_EQ("env-SECRET_MAIN", secret_main); | 
|  490   EXPECT_EQ("env-ID_CLOUD_PRINT", id_cloud_print); |  494   EXPECT_EQ("env-ID_CLOUD_PRINT", id_cloud_print); | 
|  491   EXPECT_EQ("env-SECRET_CLOUD_PRINT", secret_cloud_print); |  495   EXPECT_EQ("env-SECRET_CLOUD_PRINT", secret_cloud_print); | 
|  492   EXPECT_EQ("env-ID_REMOTING", id_remoting); |  496   EXPECT_EQ("env-ID_REMOTING", id_remoting); | 
|  493   EXPECT_EQ("env-SECRET_REMOTING", secret_remoting); |  497   EXPECT_EQ("env-SECRET_REMOTING", secret_remoting); | 
|  494   EXPECT_EQ("env-ID_REMOTING_HOST", id_remoting_host); |  498   EXPECT_EQ("env-ID_REMOTING_HOST", id_remoting_host); | 
|  495   EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host); |  499   EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host); | 
|  496 } |  500 } | 
|  497  |  501  | 
|  498 #endif  // defined(OS_LINUX) || defined(OS_MACOSX) |  502 #endif  // defined(OS_LINUX) || defined(OS_MACOSX) | 
| OLD | NEW |