OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/password_manager_test_base.h" | 5 #include "chrome/browser/password_manager/password_manager_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 13 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
13 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_io_data.h" | 16 #include "chrome/browser/profiles/profile_io_data.h" |
16 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 17 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 19 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 CustomManagePasswordsUIController::CustomManagePasswordsUIController( | 87 CustomManagePasswordsUIController::CustomManagePasswordsUIController( |
87 content::WebContents* web_contents) | 88 content::WebContents* web_contents) |
88 : ManagePasswordsUIController(web_contents), | 89 : ManagePasswordsUIController(web_contents), |
89 run_loop_(nullptr), | 90 run_loop_(nullptr), |
90 target_state_(password_manager::ui::INACTIVE_STATE) { | 91 target_state_(password_manager::ui::INACTIVE_STATE) { |
91 // Attach CustomManagePasswordsUIController to |web_contents| so the default | 92 // Attach CustomManagePasswordsUIController to |web_contents| so the default |
92 // ManagePasswordsUIController isn't created. | 93 // ManagePasswordsUIController isn't created. |
93 // Do not silently replace an existing ManagePasswordsUIController because it | 94 // Do not silently replace an existing ManagePasswordsUIController because it |
94 // unregisters itself in WebContentsDestroyed(). | 95 // unregisters itself in WebContentsDestroyed(). |
95 EXPECT_FALSE(web_contents->GetUserData(UserDataKey())); | 96 EXPECT_FALSE(web_contents->GetUserData(UserDataKey())); |
96 web_contents->SetUserData(UserDataKey(), this); | 97 web_contents->SetUserData(UserDataKey(), base::WrapUnique(this)); |
97 } | 98 } |
98 | 99 |
99 void CustomManagePasswordsUIController::WaitForState( | 100 void CustomManagePasswordsUIController::WaitForState( |
100 password_manager::ui::State target_state) { | 101 password_manager::ui::State target_state) { |
101 base::RunLoop run_loop; | 102 base::RunLoop run_loop; |
102 target_state_ = target_state; | 103 target_state_ = target_state; |
103 run_loop_ = &run_loop; | 104 run_loop_ = &run_loop; |
104 run_loop_->Run(); | 105 run_loop_->Run(); |
105 } | 106 } |
106 | 107 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 461 |
461 content::BrowserThread::PostTaskAndReply( | 462 content::BrowserThread::PostTaskAndReply( |
462 content::BrowserThread::IO, FROM_HERE, | 463 content::BrowserThread::IO, FROM_HERE, |
463 base::BindOnce( | 464 base::BindOnce( |
464 &AddHSTSHostImpl, | 465 &AddHSTSHostImpl, |
465 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), | 466 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), |
466 run_loop.QuitClosure()); | 467 run_loop.QuitClosure()); |
467 | 468 |
468 run_loop.Run(); | 469 run_loop.Run(); |
469 } | 470 } |
OLD | NEW |