Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3266)

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 1042923003: Fail gracefully when starting Chrome with an invalid kProfileDirectory. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index ac03700fe695c78442c32e3c893e94b3baee7642..c7d1fd9f725982e0b0fe3f4e4c7b218ead50b9c6 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -49,6 +49,7 @@
#include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
#include "chrome/browser/ui/tabs/pinned_tab_codec.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/user_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/pref_names.h"
@@ -2199,6 +2200,32 @@ class LaunchBrowserWithTrailingSlashDatadir : public BrowserTest {
base::ScopedTempDir temp_dir_;
};
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+// This test verifies that if Chrome is launched with an invalid
+// profile-directory argument, then the User Manager is shown instead.
+class LaunchBrowserWithInvalidProfileDirectory : public BrowserTest {
+ public:
+ LaunchBrowserWithInvalidProfileDirectory() {}
+
+ virtual void SetUpCommandLine(base::CommandLine* command_line) override {
+ command_line->AppendSwitch(switches::kEnableNewAvatarMenu);
+ command_line->AppendSwitchASCII(switches::kProfileDirectory,
+ "SomeOtherProfile");
+ }
+
+ base::ScopedTempDir temp_dir_;
+};
+
+IN_PROC_BROWSER_TEST_F(LaunchBrowserWithInvalidProfileDirectory,
+ TestUserManagerShown) {
+ // No browser window should be open, and the User Manager should be showing.
+ EXPECT_FALSE(browser());
+ EXPECT_TRUE(UserManager::IsShowing());
+ // Hide the User Manager so that the test can die.
+ UserManager::Hide();
+}
+#endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
+
IN_PROC_BROWSER_TEST_F(LaunchBrowserWithTrailingSlashDatadir,
TestTrailingSlashUserDataDir) {
// Verify that the window is present.
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698