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 |
4 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" |
5 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/profiles/profile_window.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" |
6 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
8 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
10 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
14 #include "components/signin/core/common/profile_management_switches.h" | 19 #include "components/signin/core/common/profile_management_switches.h" |
15 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 59 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
55 web_contents, | 60 web_contents, |
56 "domAutomationController.send(" | 61 "domAutomationController.send(" |
57 "parseInt(document.getElementById('pod-row').getAttribute('ncolumns')))", | 62 "parseInt(document.getElementById('pod-row').getAttribute('ncolumns')))", |
58 &num_pods)); | 63 &num_pods)); |
59 | 64 |
60 // There should be one user pod for each profile. | 65 // There should be one user pod for each profile. |
61 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 66 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
62 EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles())); | 67 EXPECT_EQ(num_pods, static_cast<int>(profile_manager->GetNumberOfProfiles())); |
63 } | 68 } |
| 69 |
| 70 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageRedirectsToAboutChrome) { |
| 71 std::string user_manager_url = chrome::kChromeUIUserManagerURL; |
| 72 user_manager_url += profiles::kUserManagerSelectProfileAboutChrome; |
| 73 |
| 74 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 75 browser(), GURL(user_manager_url), 1); |
| 76 content::WebContents* web_contents = |
| 77 browser()->tab_strip_model()->GetActiveWebContents(); |
| 78 |
| 79 base::string16 profile_name = |
| 80 profiles::GetAvatarNameForProfile(browser()->profile()->GetPath()); |
| 81 |
| 82 std::string launch_js = |
| 83 base::StringPrintf("Oobe.launchUser('', '%s')", |
| 84 base::UTF16ToUTF8(profile_name).c_str()); |
| 85 bool result = content::ExecuteScript(web_contents, launch_js); |
| 86 EXPECT_TRUE(result); |
| 87 base::RunLoop().RunUntilIdle(); |
| 88 |
| 89 content::WebContents* about_chrome_contents = |
| 90 browser()->tab_strip_model()->GetActiveWebContents(); |
| 91 GURL current_URL = about_chrome_contents->GetVisibleURL(); |
| 92 EXPECT_EQ(GURL(chrome::kChromeUIUberURL), current_URL); |
| 93 } |
OLD | NEW |