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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc

Issue 440713005: Change the title of the desktop User Manager widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser test Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/signin/user_manager_screen_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "base/command_line.h" 4 #include "base/command_line.h"
5 #include "chrome/browser/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/tabs/tab_strip_model.h" 7 #include "chrome/browser/ui/tabs/tab_strip_model.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/testing_browser_process.h" 11 #include "chrome/test/base/testing_browser_process.h"
12 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
13 #include "components/signin/core/common/profile_management_switches.h" 13 #include "components/signin/core/common/profile_management_switches.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
16 #include "grit/generated_resources.h" 16 #include "grit/chromium_strings.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 18
19 class UserManagerUIBrowserTest : public InProcessBrowserTest, 19 class UserManagerUIBrowserTest : public InProcessBrowserTest,
20 public testing::WithParamInterface<bool> { 20 public testing::WithParamInterface<bool> {
21 public: 21 public:
22 UserManagerUIBrowserTest() {} 22 UserManagerUIBrowserTest() {}
23 23
24 protected: 24 protected:
25 virtual void SetUp() OVERRIDE { 25 virtual void SetUp() OVERRIDE {
26 InProcessBrowserTest::SetUp(); 26 InProcessBrowserTest::SetUp();
27 DCHECK(switches::IsNewAvatarMenu()); 27 DCHECK(switches::IsNewAvatarMenu());
28 } 28 }
29 29
30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
31 switches::EnableNewAvatarMenuForTesting(command_line); 31 switches::EnableNewAvatarMenuForTesting(command_line);
32 } 32 }
33 }; 33 };
34 34
35 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageLoads) { 35 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageLoads) {
36 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 36 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
37 browser(), GURL(chrome::kChromeUIUserManagerURL), 1); 37 browser(), GURL(chrome::kChromeUIUserManagerURL), 1);
38 content::WebContents* web_contents = 38 content::WebContents* web_contents =
39 browser()->tab_strip_model()->GetActiveWebContents(); 39 browser()->tab_strip_model()->GetActiveWebContents();
40 40
41 base::string16 title = web_contents->GetTitle(); 41 base::string16 title = web_contents->GetTitle();
42 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_USER_MANAGER_SCREEN_TITLE), title); 42 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), title);
43 43
44 // If the page has loaded correctly, then there should be an account picker. 44 // If the page has loaded correctly, then there should be an account picker.
45 int num_account_pickers = -1; 45 int num_account_pickers = -1;
46 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 46 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
47 web_contents, 47 web_contents,
48 "domAutomationController.send(" 48 "domAutomationController.send("
49 "document.getElementsByClassName('account-picker').length)", 49 "document.getElementsByClassName('account-picker').length)",
50 &num_account_pickers)); 50 &num_account_pickers));
51 EXPECT_EQ(1, num_account_pickers); 51 EXPECT_EQ(1, num_account_pickers);
52 52
53 int num_pods = -1; 53 int num_pods = -1;
54 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 54 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
55 web_contents, 55 web_contents,
56 "domAutomationController.send(" 56 "domAutomationController.send("
57 "parseInt(document.getElementById('pod-row').getAttribute('ncolumns')))", 57 "parseInt(document.getElementById('pod-row').getAttribute('ncolumns')))",
58 &num_pods)); 58 &num_pods));
59 59
60 // There should be one user pod for each profile. 60 // There should be one user pod for each profile.
61 ProfileManager* profile_manager = g_browser_process->profile_manager(); 61 ProfileManager* profile_manager = g_browser_process->profile_manager();
62 EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles())); 62 EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles()));
63 } 63 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/user_manager_screen_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698