| 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 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_util.h" |
| 6 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/profiles/profile_window.h" | 10 #include "chrome/browser/profiles/profile_window.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" | 11 #include "chrome/browser/profiles/profiles_state.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/grit/chromium_strings.h" | 16 #include "chrome/grit/chromium_strings.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 69 } |
| 69 | 70 |
| 70 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageRedirectsToAboutChrome) { | 71 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageRedirectsToAboutChrome) { |
| 71 std::string user_manager_url = chrome::kChromeUIUserManagerURL; | 72 std::string user_manager_url = chrome::kChromeUIUserManagerURL; |
| 72 user_manager_url += profiles::kUserManagerSelectProfileAboutChrome; | 73 user_manager_url += profiles::kUserManagerSelectProfileAboutChrome; |
| 73 | 74 |
| 74 ui_test_utils::NavigateToURL(browser(), GURL(user_manager_url)); | 75 ui_test_utils::NavigateToURL(browser(), GURL(user_manager_url)); |
| 75 content::WebContents* web_contents = | 76 content::WebContents* web_contents = |
| 76 browser()->tab_strip_model()->GetActiveWebContents(); | 77 browser()->tab_strip_model()->GetActiveWebContents(); |
| 77 | 78 |
| 78 base::string16 profile_name = | 79 // If this is a Windows style path, escape all the slashes. |
| 79 profiles::GetAvatarNameForProfile(browser()->profile()->GetPath()); | 80 std::string profile_path; |
| 81 base::ReplaceChars(browser()->profile()->GetPath().MaybeAsASCII(), |
| 82 "\\", "\\\\", &profile_path); |
| 80 | 83 |
| 81 std::string launch_js = | 84 std::string launch_js = |
| 82 base::StringPrintf("Oobe.launchUser('', '%s')", | 85 base::StringPrintf("Oobe.launchUser('%s')", profile_path.c_str()); |
| 83 base::UTF16ToUTF8(profile_name).c_str()); | 86 |
| 84 bool result = content::ExecuteScript(web_contents, launch_js); | 87 bool result = content::ExecuteScript(web_contents, launch_js); |
| 85 EXPECT_TRUE(result); | 88 EXPECT_TRUE(result); |
| 86 base::RunLoop().RunUntilIdle(); | 89 base::RunLoop().RunUntilIdle(); |
| 87 | 90 |
| 88 content::WebContents* about_chrome_contents = | 91 content::WebContents* about_chrome_contents = |
| 89 browser()->tab_strip_model()->GetActiveWebContents(); | 92 browser()->tab_strip_model()->GetActiveWebContents(); |
| 90 GURL current_URL = about_chrome_contents->GetVisibleURL(); | 93 GURL current_URL = about_chrome_contents->GetVisibleURL(); |
| 91 EXPECT_EQ(GURL(chrome::kChromeUIUberURL), current_URL); | 94 EXPECT_EQ(GURL(chrome::kChromeUIUberURL), current_URL); |
| 92 } | 95 } |
| 93 | 96 |
| 94 // TODO(mlerman): Test that unlocking a locked profile causes the extensions | 97 // TODO(mlerman): Test that unlocking a locked profile causes the extensions |
| 95 // service to become unblocked. | 98 // service to become unblocked. |
| OLD | NEW |