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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 NavigateToSettingsFrame(); | 195 NavigateToSettingsFrame(); |
196 | 196 |
197 // This script simulates a click on the "Disconnect your Google Account" | 197 // This script simulates a click on the "Disconnect your Google Account" |
198 // button and returns true if the hidden flag of the appropriate dialog gets | 198 // button and returns true if the hidden flag of the appropriate dialog gets |
199 // flipped. | 199 // flipped. |
200 bool result = false; | 200 bool result = false; |
201 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 201 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
202 browser()->tab_strip_model()->GetActiveWebContents(), | 202 browser()->tab_strip_model()->GetActiveWebContents(), |
203 "var dialog = $('manage-profile-overlay-disconnect-managed');" | 203 "var dialog = $('manage-profile-overlay-disconnect-managed');" |
204 "var original_status = dialog.hidden;" | 204 "var original_status = dialog.hidden;" |
205 "$('start-stop-sync').click();" | 205 "var original = ManageProfileOverlay.showDisconnectManagedProfileDialog;" |
206 "domAutomationController.send(original_status && !dialog.hidden);", | 206 "var teststub = function(event) {" |
| 207 " original(event);" |
| 208 " domAutomationController.send(original_status && !dialog.hidden);" |
| 209 "};" |
| 210 "ManageProfileOverlay.showDisconnectManagedProfileDialog = teststub;" |
| 211 "$('start-stop-sync').click();", |
207 &result)); | 212 &result)); |
208 | 213 |
209 EXPECT_TRUE(result); | 214 EXPECT_TRUE(result); |
210 | 215 |
211 base::FilePath profile_dir = browser()->profile()->GetPath(); | 216 base::FilePath profile_dir = browser()->profile()->GetPath(); |
212 ProfileInfoCache& profile_info_cache = | 217 ProfileInfoCache& profile_info_cache = |
213 g_browser_process->profile_manager()->GetProfileInfoCache(); | 218 g_browser_process->profile_manager()->GetProfileInfoCache(); |
214 | 219 |
215 EXPECT_TRUE(DirectoryExists(profile_dir)); | 220 EXPECT_TRUE(DirectoryExists(profile_dir)); |
216 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != | 221 EXPECT_TRUE(profile_info_cache.GetIndexOfProfileWithPath(profile_dir) != |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 run_loop.Run(); | 321 run_loop.Run(); |
317 | 322 |
318 // Verify that the settings page has updated and lists two profiles. | 323 // Verify that the settings page has updated and lists two profiles. |
319 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 324 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
320 contents, javascript, &profiles)); | 325 contents, javascript, &profiles)); |
321 EXPECT_EQ(2, profiles); | 326 EXPECT_EQ(2, profiles); |
322 } | 327 } |
323 #endif | 328 #endif |
324 | 329 |
325 } // namespace options | 330 } // namespace options |
OLD | NEW |