Index: chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc |
diff --git a/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc b/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc |
index de7018c8f79374ccf32809e3cfc6fc5524881afe..2ae194a1462106d7636eedaa362b6195624dc089 100644 |
--- a/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc |
+++ b/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/profiles/profile_window.h" |
#include "chrome/browser/profiles/profiles_state.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_iterator.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/url_constants.h" |
@@ -22,6 +23,19 @@ |
#include "content/public/test/browser_test_utils.h" |
#include "ui/base/l10n/l10n_util.h" |
+namespace { |
+ |
+ int CountBrowsersForProfileByPath(const base::FilePath& profile_path) { |
noms (inactive)
2015/01/29 16:17:06
nit: wrong indentation (don't indent inside the na
Mike Lerman
2015/02/20 16:10:24
Done.
|
+ int count = 0; |
+ for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
+ if (it->profile()->GetOriginalProfile()->GetPath() == profile_path) |
+ count++; |
+ } |
+ return count; |
+ } |
+ |
+} // namespace |
+ |
class UserManagerUIBrowserTest : public InProcessBrowserTest, |
public testing::WithParamInterface<bool> { |
public: |
@@ -94,5 +108,25 @@ IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageRedirectsToAboutChrome) { |
EXPECT_EQ(GURL(chrome::kChromeUIUberURL), current_URL); |
} |
+IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, LaunchGuest) { |
+ std::string user_manager_url = chrome::kChromeUIUserManagerURL; |
+ |
+ ui_test_utils::NavigateToURL(browser(), GURL(user_manager_url)); |
+ content::WebContents* web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ EXPECT_EQ(0, CountBrowsersForProfileByPath( |
+ ProfileManager::GetGuestProfilePath())); |
+ |
+ std::string launch_js = |
+ base::StringPrintf("chrome.send('launchGuest')"); |
+ |
+ bool result = content::ExecuteScript(web_contents, launch_js); |
+ EXPECT_TRUE(result); |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ EXPECT_GE(1, CountBrowsersForProfileByPath( |
+ ProfileManager::GetGuestProfilePath())); |
+} |
+ |
// TODO(mlerman): Test that unlocking a locked profile causes the extensions |
// service to become unblocked. |