OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/options_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_TRUE(result); | 223 EXPECT_TRUE(result); |
224 | 224 |
225 base::FilePath profile_dir = browser()->profile()->GetPath(); | 225 base::FilePath profile_dir = browser()->profile()->GetPath(); |
226 ProfileInfoCache& profile_info_cache = | 226 ProfileInfoCache& profile_info_cache = |
227 g_browser_process->profile_manager()->GetProfileInfoCache(); | 227 g_browser_process->profile_manager()->GetProfileInfoCache(); |
228 | 228 |
229 EXPECT_TRUE(DirectoryExists(profile_dir)); | 229 EXPECT_TRUE(DirectoryExists(profile_dir)); |
230 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != | 230 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != |
231 std::string::npos); | 231 std::string::npos); |
232 | 232 |
233 content::WindowedNotificationObserver wait_for_profile_deletion( | |
234 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | |
235 content::NotificationService::AllSources()); | |
236 | |
237 // TODO(kaliamoorthi): Get the macos problem fixed and remove this code. | 233 // TODO(kaliamoorthi): Get the macos problem fixed and remove this code. |
238 // Deleting the Profile also destroys all browser windows of that Profile. | 234 // Deleting the Profile also destroys all browser windows of that Profile. |
239 // Wait for the current browser to close before resuming, otherwise | 235 // Wait for the current browser to close before resuming, otherwise |
240 // the browser_tests shutdown code will be confused on the Mac. | 236 // the browser_tests shutdown code will be confused on the Mac. |
241 content::WindowedNotificationObserver wait_for_browser_closed( | 237 content::WindowedNotificationObserver wait_for_browser_closed( |
242 chrome::NOTIFICATION_BROWSER_CLOSED, | 238 chrome::NOTIFICATION_BROWSER_CLOSED, |
243 content::NotificationService::AllSources()); | 239 content::NotificationService::AllSources()); |
244 | 240 |
245 ASSERT_TRUE(content::ExecuteScript( | 241 ASSERT_TRUE(content::ExecuteScript( |
246 browser()->tab_strip_model()->GetActiveWebContents(), | 242 browser()->tab_strip_model()->GetActiveWebContents(), |
247 "$('disconnect-managed-profile-ok').click();")); | 243 "$('disconnect-managed-profile-ok').click();")); |
248 | 244 |
249 wait_for_profile_deletion.Wait(); | |
250 | |
251 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == | 245 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == |
252 std::string::npos); | 246 std::string::npos); |
253 | 247 |
254 wait_for_browser_closed.Wait(); | 248 wait_for_browser_closed.Wait(); |
255 } | 249 } |
256 | 250 |
257 IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { | 251 IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { |
258 SigninManager* signin = | 252 SigninManager* signin = |
259 SigninManagerFactory::GetForProfile(browser()->profile()); | 253 SigninManagerFactory::GetForProfile(browser()->profile()); |
260 const std::string user = "test@example.com"; | 254 const std::string user = "test@example.com"; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 run_loop.Run(); | 324 run_loop.Run(); |
331 | 325 |
332 // Verify that the settings page has updated and lists two profiles. | 326 // Verify that the settings page has updated and lists two profiles. |
333 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 327 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
334 contents, javascript, &profiles)); | 328 contents, javascript, &profiles)); |
335 EXPECT_EQ(2, profiles); | 329 EXPECT_EQ(2, profiles); |
336 } | 330 } |
337 #endif | 331 #endif |
338 | 332 |
339 } // namespace options | 333 } // namespace options |
OLD | NEW |