This source file includes following definitions.
- SetUp
- SetUpCommandLine
- IN_PROC_BROWSER_TEST_F
#include "base/command_line.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
const GURL& url = GURL(chrome::kChromeUIUserManagerURL);
}
class UserManagerUIBrowserTest : public InProcessBrowserTest,
public testing::WithParamInterface<bool> {
public:
UserManagerUIBrowserTest() {}
protected:
virtual void SetUp() OVERRIDE {
InProcessBrowserTest::SetUp();
DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNewProfileManagement));
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kNewProfileManagement);
}
};
IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageLoads) {
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1);
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
base::string16 title = web_contents->GetTitle();
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_USER_MANAGER_SCREEN_TITLE), title);
int num_account_pickers = -1;
ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
web_contents,
"domAutomationController.send("
"document.getElementsByClassName('account-picker').length)",
&num_account_pickers));
EXPECT_EQ(1, num_account_pickers);
int num_pods = -1;
ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
web_contents,
"domAutomationController.send("
"parseInt(document.getElementById('pod-row').getAttribute('ncolumns')))",
&num_pods));
ProfileManager* profile_manager = g_browser_process->profile_manager();
EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles()));
}