summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/profiles/profile_impl.cc12
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/test/test_launcher_utils.cc7
5 files changed, 25 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 4603d6b..68a15ff 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -109,6 +109,7 @@
#include "chrome/installer/util/install_util.h"
#elif defined(OS_MACOSX)
#include "chrome/browser/keychain_mac.h"
+#include "chrome/browser/mock_keychain_mac.h"
#include "chrome/browser/password_manager/password_store_mac.h"
#elif defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/enterprise_extension_observer.h"
@@ -135,6 +136,11 @@ namespace {
// Delay, in milliseconds, before we explicitly create the SessionService.
static const int kCreateSessionServiceDelayMS = 500;
+#if defined(OS_MACOSX)
+// Capacity for mock keychain used for testing.
+static const int kMockKeychainSize = 1000;
+#endif
+
enum ContextType {
kNormalContext,
kMediaContext
@@ -1185,7 +1191,11 @@ void ProfileImpl::CreatePasswordStore() {
ps = new PasswordStoreWin(login_db, this,
GetWebDataService(Profile::IMPLICIT_ACCESS));
#elif defined(OS_MACOSX)
- ps = new PasswordStoreMac(new MacKeychain(), login_db);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) {
+ ps = new PasswordStoreMac(new MockKeychain(kMockKeychainSize), login_db);
+ } else {
+ ps = new PasswordStoreMac(new MacKeychain(), login_db);
+ }
#elif defined(OS_CHROMEOS)
// For now, we use PasswordStoreDefault. We might want to make a native
// backend for PasswordStoreX (see below) in the future though.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f156eed..2c2449e 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1409,6 +1409,8 @@
'browser/metrics/metrics_service.h',
'browser/metrics/thread_watcher.cc',
'browser/metrics/thread_watcher.h',
+ 'browser/mock_keychain_mac.cc',
+ 'browser/mock_keychain_mac.h',
'browser/nacl_host/nacl_broker_host_win.cc',
'browser/nacl_host/nacl_broker_host_win.h',
'browser/nacl_host/nacl_broker_service_win.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 51cd405..8148dfe 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1155,6 +1155,10 @@ const char kEnableExposeForTabs[] = "enable-expose-for-tabs";
// A process type (switches::kProcessType) that relaunches the browser. See
// chrome/browser/mac/relauncher.h.
const char kRelauncherProcess[] = "relauncher";
+
+// Use mock keychain for testing purposes, which prevents blocking dialogs from
+// causing timeouts.
+const char kUseMockKeychain[] = "use-mock-keychain";
#endif
#if !defined(OS_MACOSX)
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index a6da014..4804c3c 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -331,6 +331,7 @@ extern const char kPasswordStore[];
#if defined(OS_MACOSX)
extern const char kEnableExposeForTabs[];
extern const char kRelauncherProcess[];
+extern const char kUseMockKeychain[];
#endif
#if !defined(OS_MACOSX)
diff --git a/chrome/test/test_launcher_utils.cc b/chrome/test/test_launcher_utils.cc
index b9e6541..37426a5 100644
--- a/chrome/test/test_launcher_utils.cc
+++ b/chrome/test/test_launcher_utils.cc
@@ -54,6 +54,13 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) {
if (!command_line->HasSwitch(switches::kPasswordStore))
command_line->AppendSwitchASCII(switches::kPasswordStore, "basic");
#endif
+
+#if defined(OS_MACOSX)
+ // Use mock keychain on mac to prevent blocking permissions dialogs.
+ // TODO(sync): Re-enable when mock keyring works with sync integration tests.
+ // See crbug.com/89808.
+ // command_line->AppendSwitch(switches::kUseMockKeychain);
+#endif
}
bool OverrideUserDataDir(const FilePath& user_data_dir) {