| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <deque> | 6 #include <deque> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
| 21 #include "base/scoped_observer.h" | 21 #include "base/scoped_observer.h" |
| 22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 23 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/test/scoped_feature_list.h" | 27 #include "base/test/scoped_feature_list.h" |
| 28 #include "base/test/simple_test_tick_clock.h" | 28 #include "base/test/simple_test_tick_clock.h" |
| 29 #include "base/test/test_timeouts.h" | 29 #include "base/test/test_timeouts.h" |
| 30 #include "base/threading/thread_restrictions.h" |
| 30 #include "base/values.h" | 31 #include "base/values.h" |
| 31 #include "build/build_config.h" | 32 #include "build/build_config.h" |
| 32 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 33 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 33 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 34 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 34 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 35 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 35 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 36 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 36 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 37 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 37 #include "chrome/browser/chrome_content_browser_client.h" | 38 #include "chrome/browser/chrome_content_browser_client.h" |
| 38 #include "chrome/browser/chrome_notification_types.h" | 39 #include "chrome/browser/chrome_notification_types.h" |
| 39 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 40 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| (...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3253 "window.domAutomationController.send(" | 3254 "window.domAutomationController.send(" |
| 3254 "document.getElementsByTagName('pre')[0].innerText);", | 3255 "document.getElementsByTagName('pre')[0].innerText);", |
| 3255 &body)); | 3256 &body)); |
| 3256 EXPECT_EQ("text=value\n", body); | 3257 EXPECT_EQ("text=value\n", body); |
| 3257 } | 3258 } |
| 3258 | 3259 |
| 3259 // Prerenders a page that tries to automatically sign user in via the Credential | 3260 // Prerenders a page that tries to automatically sign user in via the Credential |
| 3260 // Manager API. The page should be killed. | 3261 // Manager API. The page should be killed. |
| 3261 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, AutosigninInPrerenderer) { | 3262 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, AutosigninInPrerenderer) { |
| 3262 // Set up a credential in the password store. | 3263 // Set up a credential in the password store. |
| 3263 PasswordStoreFactory::GetInstance()->SetTestingFactory( | 3264 { |
| 3264 current_browser()->profile(), | 3265 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 3265 password_manager::BuildPasswordStore< | 3266 PasswordStoreFactory::GetInstance()->SetTestingFactory( |
| 3266 content::BrowserContext, password_manager::TestPasswordStore>); | 3267 current_browser()->profile(), |
| 3268 password_manager::BuildPasswordStore< |
| 3269 content::BrowserContext, password_manager::TestPasswordStore>); |
| 3270 } |
| 3267 scoped_refptr<password_manager::TestPasswordStore> password_store = | 3271 scoped_refptr<password_manager::TestPasswordStore> password_store = |
| 3268 static_cast<password_manager::TestPasswordStore*>( | 3272 static_cast<password_manager::TestPasswordStore*>( |
| 3269 PasswordStoreFactory::GetForProfile( | 3273 PasswordStoreFactory::GetForProfile( |
| 3270 current_browser()->profile(), | 3274 current_browser()->profile(), |
| 3271 ServiceAccessType::IMPLICIT_ACCESS).get()); | 3275 ServiceAccessType::IMPLICIT_ACCESS).get()); |
| 3272 autofill::PasswordForm signin_form; | 3276 autofill::PasswordForm signin_form; |
| 3273 signin_form.signon_realm = embedded_test_server()->base_url().spec(); | 3277 signin_form.signon_realm = embedded_test_server()->base_url().spec(); |
| 3274 signin_form.password_value = base::ASCIIToUTF16("password"); | 3278 signin_form.password_value = base::ASCIIToUTF16("password"); |
| 3275 signin_form.username_value = base::ASCIIToUTF16("user"); | 3279 signin_form.username_value = base::ASCIIToUTF16("user"); |
| 3276 signin_form.origin = embedded_test_server()->base_url(); | 3280 signin_form.origin = embedded_test_server()->base_url(); |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3915 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, | 3919 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, |
| 3916 "DidDisplayReallyPass()", | 3920 "DidDisplayReallyPass()", |
| 3917 &display_test_result)); | 3921 &display_test_result)); |
| 3918 ASSERT_TRUE(display_test_result); | 3922 ASSERT_TRUE(display_test_result); |
| 3919 } | 3923 } |
| 3920 #endif // !defined(DISABLE_NACL) | 3924 #endif // !defined(DISABLE_NACL) |
| 3921 | 3925 |
| 3922 } // namespace prerender | 3926 } // namespace prerender |
| 3923 | 3927 |
| 3924 #endif // !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER) | 3928 #endif // !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER) |
| OLD | NEW |