diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 23:38:22 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 23:38:22 +0000 |
commit | e03604b93e09e919287a853d68e740c9e6f0fb9f (patch) | |
tree | d86464635da2d96781cf48f9b8cbeca95638df7b /google_apis | |
parent | 2ee2f5db813d4f9ac9c129c67c3fb2b3c01ae999 (diff) | |
download | chromium_src-e03604b93e09e919287a853d68e740c9e6f0fb9f.zip chromium_src-e03604b93e09e919287a853d68e740c9e6f0fb9f.tar.gz chromium_src-e03604b93e09e919287a853d68e740c9e6f0fb9f.tar.bz2 |
Avoid having two copies of implementation from google_api_keys.cc
This fixes a problem that was only happening with some linkers, where
the linker would choose the version of functions from
google_api_keys.cc that was defined in the google_api_keys_unittest.cc
file when that source file got #included at global scope. Thanks to
blundell@chromium.org for the report.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/11819043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/google_api_keys.cc | 2 | ||||
-rw-r--r-- | google_apis/google_api_keys.h | 2 | ||||
-rw-r--r-- | google_apis/google_api_keys_unittest.cc | 19 |
3 files changed, 19 insertions, 4 deletions
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc index 830a135..5b11247 100644 --- a/google_apis/google_api_keys.cc +++ b/google_apis/google_api_keys.cc @@ -4,6 +4,8 @@ #include "google_apis/google_api_keys.h" +// If you add more includes to this list, you also need to add them to +// google_api_keys_unittest.cc. #include "base/command_line.h" #include "base/environment.h" #include "base/lazy_instance.h" diff --git a/google_apis/google_api_keys.h b/google_apis/google_api_keys.h index 8ba3215..28905ac 100644 --- a/google_apis/google_api_keys.h +++ b/google_apis/google_api_keys.h @@ -5,6 +5,8 @@ #ifndef GOOGLE_APIS_GOOGLE_API_KEYS_H_ #define GOOGLE_APIS_GOOGLE_API_KEYS_H_ +// If you add more includes to this file, you also need to add them to +// google_api_keys_unittest.cc. #include <string> // These functions enable you to retrieve keys to use for Google APIs diff --git a/google_apis/google_api_keys_unittest.cc b/google_apis/google_api_keys_unittest.cc index 39427cb8..a733bfc 100644 --- a/google_apis/google_api_keys_unittest.cc +++ b/google_apis/google_api_keys_unittest.cc @@ -10,6 +10,8 @@ // This is a little unorthodox, but it lets us test the behavior as // close to unmodified as possible. +#include "google_apis/google_api_keys.h" + #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" @@ -21,10 +23,19 @@ // since there are no platform-specific bits in this code. #if defined(OS_LINUX) || defined(OS_MACOSX) -// We need to include this once at global scope so things like STL and -// classes from base do not get defined again within the different -// namespaces below. -#include "google_apis/google_api_keys.cc" +// We need to include everything included by google_api_keys.cc once +// at global scope so that things like STL and classes from base don't +// get defined when we re-include the google_api_keys.cc file +// below. We used to include that file in its entirety here, but that +// can cause problems if the linker decides the version of symbols +// from that file included here is the "right" version. +#include <string> +#include "base/command_line.h" +#include "base/environment.h" +#include "base/lazy_instance.h" +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "base/stringize_macros.h" // These are the (temporary) default values for OAuth IDs and secrets. static const char kDefaultNonOfficialAPIKey[] = |