Index: chrome/browser/ui/webui/options/options_ui_browsertest.cc |
diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc |
index 41b38138635435802422ab27ab4b3084bf150207..0313cc4dc807768ea539470a91e448dd47a52524 100644 |
--- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc |
+++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc |
@@ -8,6 +8,7 @@ |
#include "base/scoped_observer.h" |
#include "base/strings/string16.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/chrome_pages.h" |
@@ -18,6 +19,7 @@ |
#include "chrome/common/url_constants.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "components/signin/core/browser/signin_manager.h" |
+#include "content/public/browser/notification_service.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/test/browser_test_utils.h" |
@@ -168,7 +170,69 @@ IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, LoadOptionsByURL) { |
VerifyNavbar(); |
} |
+// Flaky on win_rel when the profile is deleted crbug.com/103355 |
+// Also related to crbug.com/104851 |
+#if defined(OS_WIN) |
+#define MAYBE_VerifyManagedSignout DISABLED_VerifyManagedSignout |
+#else |
+#define MAYBE_VerifyManagedSignout VerifyManagedSignout |
+#endif |
+ |
#if !defined(OS_CHROMEOS) |
+IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, MAYBE_VerifyManagedSignout) { |
+ SigninManager* signin = |
+ SigninManagerFactory::GetForProfile(browser()->profile()); |
+ signin->OnExternalSigninCompleted("test@example.com"); |
+ signin->ProhibitSignout(true); |
+ |
+ NavigateToSettingsFrame(); |
+ |
+ // This script simulates a click on the "Disconnect your Google Account" |
+ // button and returns true if the hidden flag of the appropriate dialog gets |
+ // flipped. |
+ bool result = false; |
+ ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
+ browser()->tab_strip_model()->GetActiveWebContents(), |
+ "var dialog = $('manage-profile-overlay-disconnect-managed');" |
+ "var original_status = dialog.hidden;" |
+ "$('start-stop-sync').click();" |
+ "domAutomationController.send(original_status && !dialog.hidden);", |
+ &result)); |
+ |
+ EXPECT_TRUE(result); |
+ |
+ base::FilePath profile_dir = browser()->profile()->GetPath(); |
+ ProfileInfoCache& profile_info_cache = |
+ g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ |
+ EXPECT_TRUE(DirectoryExists(profile_dir)); |
+ EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != |
+ std::string::npos); |
+ |
+ content::WindowedNotificationObserver wait_for_profile_deletion( |
+ chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
+ content::NotificationService::AllSources()); |
+ |
+ // TODO(kaliamoorthi): Get the macos problem fixed and remove this code. |
+ // Deleting the Profile also destroys all browser windows of that Profile. |
+ // Wait for the current browser to close before resuming, otherwise |
+ // the browser_tests shutdown code will be confused on the Mac. |
+ content::WindowedNotificationObserver wait_for_browser_closed( |
+ chrome::NOTIFICATION_BROWSER_CLOSED, |
+ content::NotificationService::AllSources()); |
+ |
+ ASSERT_TRUE(content::ExecuteScript( |
+ browser()->tab_strip_model()->GetActiveWebContents(), |
+ "$('disconnect-managed-profile-ok').click();")); |
+ |
+ wait_for_profile_deletion.Wait(); |
+ |
+ EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == |
+ std::string::npos); |
+ |
+ wait_for_browser_closed.Wait(); |
+} |
+ |
IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { |
SigninManager* signin = |
SigninManagerFactory::GetForProfile(browser()->profile()); |