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" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/signin/account_tracker_service_factory.h" |
12 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/chrome_pages.h" | 15 #include "chrome/browser/ui/chrome_pages.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/browser/ui/webui/options/options_ui.h" | 17 #include "chrome/browser/ui/webui/options/options_ui.h" |
17 #include "chrome/browser/ui/webui/uber/uber_ui.h" | 18 #include "chrome/browser/ui/webui/uber/uber_ui.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "components/signin/core/browser/account_tracker_service.h" |
21 #include "components/signin/core/browser/signin_manager.h" | 23 #include "components/signin/core/browser/signin_manager.h" |
22 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
24 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
25 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
26 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
27 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
28 | 30 |
29 #if !defined(OS_CHROMEOS) | 31 #if !defined(OS_CHROMEOS) |
30 #include <string> | 32 #include <string> |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 browser()->tab_strip_model()->GetActiveWebContents(), | 243 browser()->tab_strip_model()->GetActiveWebContents(), |
242 "$('disconnect-managed-profile-ok').click();")); | 244 "$('disconnect-managed-profile-ok').click();")); |
243 | 245 |
244 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == | 246 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) == |
245 std::string::npos); | 247 std::string::npos); |
246 | 248 |
247 wait_for_browser_closed.Wait(); | 249 wait_for_browser_closed.Wait(); |
248 } | 250 } |
249 | 251 |
250 IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { | 252 IN_PROC_BROWSER_TEST_F(OptionsUIBrowserTest, VerifyUnmanagedSignout) { |
| 253 const std::string user = "test@example.com"; |
| 254 std::string account_id = |
| 255 AccountTrackerServiceFactory::GetForProfile(browser()->profile()) |
| 256 ->SeedAccountInfo("12345", user); |
251 SigninManager* signin = | 257 SigninManager* signin = |
252 SigninManagerFactory::GetForProfile(browser()->profile()); | 258 SigninManagerFactory::GetForProfile(browser()->profile()); |
253 const std::string user = "test@example.com"; | 259 signin->OnExternalSigninCompleted(account_id); |
254 signin->OnExternalSigninCompleted(user); | |
255 | 260 |
256 NavigateToSettingsFrame(); | 261 NavigateToSettingsFrame(); |
257 | 262 |
258 // This script simulates a click on the "Disconnect your Google Account" | 263 // This script simulates a click on the "Disconnect your Google Account" |
259 // button and returns true if the hidden flag of the appropriate dialog gets | 264 // button and returns true if the hidden flag of the appropriate dialog gets |
260 // flipped. | 265 // flipped. |
261 bool result = false; | 266 bool result = false; |
262 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 267 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
263 browser()->tab_strip_model()->GetActiveWebContents(), | 268 browser()->tab_strip_model()->GetActiveWebContents(), |
264 "var dialog = $('sync-setup-stop-syncing');" | 269 "var dialog = $('sync-setup-stop-syncing');" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 run_loop.Run(); | 328 run_loop.Run(); |
324 | 329 |
325 // Verify that the settings page has updated and lists two profiles. | 330 // Verify that the settings page has updated and lists two profiles. |
326 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 331 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
327 contents, javascript, &profiles)); | 332 contents, javascript, &profiles)); |
328 EXPECT_EQ(2, profiles); | 333 EXPECT_EQ(2, profiles); |
329 } | 334 } |
330 #endif | 335 #endif |
331 | 336 |
332 } // namespace options | 337 } // namespace options |
OLD | NEW |