summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorfgorski@chromium.org <fgorski@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 05:32:15 +0000
committerfgorski@chromium.org <fgorski@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 05:32:15 +0000
commit0ac6960da8d95d04172916cc541a67e7b9e1be64 (patch)
treed34c8e85df476ba472cd98d033ad4d2badd11bc5 /google_apis
parent43eb3b94e46f4f8aeea01c74587d6133bcf4b49c (diff)
downloadchromium_src-0ac6960da8d95d04172916cc541a67e7b9e1be64.zip
chromium_src-0ac6960da8d95d04172916cc541a67e7b9e1be64.tar.gz
chromium_src-0ac6960da8d95d04172916cc541a67e7b9e1be64.tar.bz2
Revert of Removing the mock-keychain related bool from GCMStore constructor (https://codereview.chromium.org/221453003/)
Reason for revert: gcm_unit_tests were disabled on a Mac because they were hanging on build bots. This is due to a combination of factors such as gcm_unit_tests not running in the CQ and possible keychain related configuration updates. In order to fix the problem step by step, this change will have to be attempted again. Original issue's description: > Removing the mock-keychain related bool from GCMStore constructor > > Removing the first parameter of GCMStore constructor. > Adding BuildGCMStore to GCMInternalsBuilder. > > BUG=342360 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=261842 TBR=jianli@chromium.org,zea@chromium.org NOTREECHECKS=true NOTRY=true BUG=342360 Review URL: https://codereview.chromium.org/226223005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262333 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gcm/engine/gcm_store_impl.cc5
-rw-r--r--google_apis/gcm/engine/gcm_store_impl.h3
-rw-r--r--google_apis/gcm/engine/gcm_store_impl_unittest.cc5
-rw-r--r--google_apis/gcm/engine/mcs_client_unittest.cc3
-rw-r--r--google_apis/gcm/gcm_client_impl.cc10
-rw-r--r--google_apis/gcm/gcm_client_impl.h4
-rw-r--r--google_apis/gcm/gcm_client_impl_unittest.cc15
-rw-r--r--google_apis/gcm/tools/mcs_probe.cc3
8 files changed, 13 insertions, 35 deletions
diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc
index 9bd562d..3a74127 100644
--- a/google_apis/gcm/engine/gcm_store_impl.cc
+++ b/google_apis/gcm/engine/gcm_store_impl.cc
@@ -605,11 +605,16 @@ bool GCMStoreImpl::Backend::LoadLastCheckinTime(
}
GCMStoreImpl::GCMStoreImpl(
+ bool use_mock_keychain,
const base::FilePath& path,
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner)
: backend_(new Backend(path, base::MessageLoopProxy::current())),
blocking_task_runner_(blocking_task_runner),
weak_ptr_factory_(this) {
+// On OSX, prevent the Keychain permissions popup during unit tests.
+#if defined(OS_MACOSX)
+ OSCrypt::UseMockKeychain(use_mock_keychain);
+#endif
}
GCMStoreImpl::~GCMStoreImpl() {}
diff --git a/google_apis/gcm/engine/gcm_store_impl.h b/google_apis/gcm/engine/gcm_store_impl.h
index a1eeff6..a08a72c 100644
--- a/google_apis/gcm/engine/gcm_store_impl.h
+++ b/google_apis/gcm/engine/gcm_store_impl.h
@@ -23,7 +23,8 @@ namespace gcm {
// all callbacks to the thread on which the GCMStoreImpl is created.
class GCM_EXPORT GCMStoreImpl : public GCMStore {
public:
- GCMStoreImpl(const base::FilePath& path,
+ GCMStoreImpl(bool use_mock_keychain,
+ const base::FilePath& path,
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
virtual ~GCMStoreImpl();
diff --git a/google_apis/gcm/engine/gcm_store_impl_unittest.cc b/google_apis/gcm/engine/gcm_store_impl_unittest.cc
index 41bb427..af5fc3a 100644
--- a/google_apis/gcm/engine/gcm_store_impl_unittest.cc
+++ b/google_apis/gcm/engine/gcm_store_impl_unittest.cc
@@ -14,7 +14,6 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
-#include "components/os_crypt/os_crypt.h"
#include "google_apis/gcm/base/mcs_message.h"
#include "google_apis/gcm/base/mcs_util.h"
#include "google_apis/gcm/protocol/mcs.pb.h"
@@ -72,10 +71,8 @@ GCMStoreImplTest::GCMStoreImplTest()
GCMStoreImplTest::~GCMStoreImplTest() {}
scoped_ptr<GCMStore> GCMStoreImplTest::BuildGCMStore() {
-#if defined(OS_MACOSX)
- OSCrypt::UseMockKeychain(true);
-#endif
return scoped_ptr<GCMStore>(new GCMStoreImpl(
+ true,
temp_directory_.path(),
message_loop_.message_loop_proxy()));
}
diff --git a/google_apis/gcm/engine/mcs_client_unittest.cc b/google_apis/gcm/engine/mcs_client_unittest.cc
index 85d5587..5983ddd 100644
--- a/google_apis/gcm/engine/mcs_client_unittest.cc
+++ b/google_apis/gcm/engine/mcs_client_unittest.cc
@@ -156,7 +156,8 @@ MCSClientTest::MCSClientTest()
MCSClientTest::~MCSClientTest() {}
void MCSClientTest::BuildMCSClient() {
- gcm_store_.reset(new GCMStoreImpl(temp_directory_.path(),
+ gcm_store_.reset(new GCMStoreImpl(true,
+ temp_directory_.path(),
message_loop_.message_loop_proxy()));
mcs_client_.reset(new TestMCSClient(&clock_,
&connection_factory_,
diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc
index 568e740..9aaa043 100644
--- a/google_apis/gcm/gcm_client_impl.cc
+++ b/google_apis/gcm/gcm_client_impl.cc
@@ -125,13 +125,6 @@ scoped_ptr<base::Clock> GCMInternalsBuilder::BuildClock() {
return make_scoped_ptr<base::Clock>(new base::DefaultClock());
}
-scoped_ptr<GCMStore> GCMInternalsBuilder::BuildGCMStore(
- const base::FilePath& path,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) {
- return make_scoped_ptr<GCMStore>(
- new GCMStoreImpl(path, blocking_task_runner));
-}
-
scoped_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient(
const std::string& version,
base::Clock* clock,
@@ -192,8 +185,7 @@ void GCMClientImpl::Initialize(
chrome_build_proto_.CopyFrom(chrome_build_proto);
account_ids_ = account_ids;
- gcm_store_ =
- internals_builder_->BuildGCMStore(path, blocking_task_runner).Pass();
+ gcm_store_.reset(new GCMStoreImpl(false, path, blocking_task_runner));
delegate_ = delegate;
diff --git a/google_apis/gcm/gcm_client_impl.h b/google_apis/gcm/gcm_client_impl.h
index 51ca7be..0349270 100644
--- a/google_apis/gcm/gcm_client_impl.h
+++ b/google_apis/gcm/gcm_client_impl.h
@@ -27,7 +27,6 @@ class GURL;
namespace base {
class Clock;
-class FilePath;
} // namespace base
namespace net {
@@ -48,9 +47,6 @@ class GCM_EXPORT GCMInternalsBuilder {
virtual ~GCMInternalsBuilder();
virtual scoped_ptr<base::Clock> BuildClock();
- virtual scoped_ptr<GCMStore> BuildGCMStore(
- const base::FilePath& path,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
virtual scoped_ptr<MCSClient> BuildMCSClient(
const std::string& version,
base::Clock* clock,
diff --git a/google_apis/gcm/gcm_client_impl_unittest.cc b/google_apis/gcm/gcm_client_impl_unittest.cc
index 39fb3f1..229feab 100644
--- a/google_apis/gcm/gcm_client_impl_unittest.cc
+++ b/google_apis/gcm/gcm_client_impl_unittest.cc
@@ -13,7 +13,6 @@
#include "google_apis/gcm/base/mcs_util.h"
#include "google_apis/gcm/engine/fake_connection_factory.h"
#include "google_apis/gcm/engine/fake_connection_handler.h"
-#include "google_apis/gcm/engine/gcm_store_impl.h"
#include "google_apis/gcm/protocol/android_checkin.pb.h"
#include "google_apis/gcm/protocol/checkin.pb.h"
#include "google_apis/gcm/protocol/mcs.pb.h"
@@ -118,10 +117,6 @@ class FakeGCMInternalsBuilder : public GCMInternalsBuilder {
virtual ~FakeGCMInternalsBuilder();
virtual scoped_ptr<base::Clock> BuildClock() OVERRIDE;
- virtual scoped_ptr<GCMStore> BuildGCMStore(
- const base::FilePath& path,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner)
- OVERRIDE;
virtual scoped_ptr<MCSClient> BuildMCSClient(
const std::string& version,
base::Clock* clock,
@@ -142,16 +137,6 @@ scoped_ptr<base::Clock> FakeGCMInternalsBuilder::BuildClock() {
return make_scoped_ptr<base::Clock>(new base::SimpleTestClock());
}
-scoped_ptr<GCMStore> FakeGCMInternalsBuilder::BuildGCMStore(
- const base::FilePath& path,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) {
-#if defined(OS_MACOSX)
- OSCrypt::UseMockKeychain(true);
-#endif
- return make_scoped_ptr<GCMStore>(
- new GCMStoreImpl(path, blocking_task_runner));
-}
-
scoped_ptr<MCSClient> FakeGCMInternalsBuilder::BuildMCSClient(
const std::string& version,
base::Clock* clock,
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc
index 6d9a7d5..157a73f 100644
--- a/google_apis/gcm/tools/mcs_probe.cc
+++ b/google_apis/gcm/tools/mcs_probe.cc
@@ -300,7 +300,8 @@ void MCSProbe::Start() {
network_session_,
&net_log_));
gcm_store_.reset(
- new GCMStoreImpl(gcm_store_path_,
+ new GCMStoreImpl(true,
+ gcm_store_path_,
file_thread_.message_loop_proxy()));
mcs_client_.reset(new MCSClient("probe",
&clock_,