summaryrefslogtreecommitdiffstats
path: root/google_apis/google_api_keys_unittest.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 23:38:22 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 23:38:22 +0000
commite03604b93e09e919287a853d68e740c9e6f0fb9f (patch)
treed86464635da2d96781cf48f9b8cbeca95638df7b /google_apis/google_api_keys_unittest.cc
parent2ee2f5db813d4f9ac9c129c67c3fb2b3c01ae999 (diff)
downloadchromium_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/google_api_keys_unittest.cc')
-rw-r--r--google_apis/google_api_keys_unittest.cc19
1 files changed, 15 insertions, 4 deletions
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[] =