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

Unified Diff: chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc

Issue 871893003: Browser test for launching guest mode from the User Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698