OLD | NEW |
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 "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 class UserManagerUIBrowserTest : public InProcessBrowserTest, | 19 class UserManagerUIBrowserTest : public InProcessBrowserTest, |
19 public testing::WithParamInterface<bool> { | 20 public testing::WithParamInterface<bool> { |
20 public: | 21 public: |
21 UserManagerUIBrowserTest() {} | 22 UserManagerUIBrowserTest() {} |
22 | 23 |
23 protected: | 24 protected: |
24 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() OVERRIDE { |
25 InProcessBrowserTest::SetUp(); | 26 InProcessBrowserTest::SetUp(); |
26 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 27 DCHECK(switches::IsNewProfileManagement()); |
27 switches::kNewProfileManagement)); | |
28 } | 28 } |
29 | 29 |
30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
31 command_line->AppendSwitch(switches::kNewProfileManagement); | 31 switches::EnableNewProfileManagementForTesting(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(); |
(...skipping 12 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |