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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc

Issue 1304943006: ProfileChooserVIew heap-use-after-free fix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove un-needed import Created 5 years, 3 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/ui/views/frame/browser_view.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/views/profiles/profile_chooser_view_browsertest.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
index 00c34db86403cf1327df2c1fd5389adb8018eb15..14a3246d2199201259b5915ea42d730925193111 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
@@ -50,6 +50,18 @@ Profile* CreateTestingProfile(const std::string& profile_name) {
return profile;
}
+Profile* CreateProfileOutsideUserDataDir() {
+ base::FilePath path;
+ if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &path))
+ NOTREACHED() << "Could not create directory at " << path.MaybeAsASCII();
+
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ Profile* profile =
+ Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS);
+ profile_manager->RegisterTestingProfile(profile, true, false);
+ return profile;
+}
+
// Set up the profiles to enable Lock. Takes as parameter a profile that will be
// signed in, and also creates a supervised user (necessary for lock).
void SetupProfilesForLock(Profile* signed_in) {
@@ -184,6 +196,20 @@ class ProfileChooserViewExtensionsTest : public ExtensionBrowserTest {
DISALLOW_COPY_AND_ASSIGN(ProfileChooserViewExtensionsTest);
};
+IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest,
+ NoProfileChooserOnOutsideUserDataDirProfiles) {
+ // Test that the profile chooser view does not show when avatar menu is not
+ // available. This can be repro'ed with a profile path outside user_data_dir.
+ // crbug.com/527505
+ Profile* new_profile = CreateProfileOutsideUserDataDir();
+ Browser* browser = CreateBrowser(new_profile);
+ browser->window()->ShowAvatarBubbleFromAvatarButton(
+ BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN,
+ signin::ManageAccountsParams());
+ ASSERT_FALSE(ProfileChooserView::IsShowing());
+ CloseBrowserSynchronously(browser);
+}
+
IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, SigninButtonHasFocus) {
ASSERT_TRUE(profiles::IsMultipleProfilesEnabled());
ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser()));
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698