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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CustomManagePasswordsUIController::CustomManagePasswordsUIController( | 88 CustomManagePasswordsUIController::CustomManagePasswordsUIController( |
88 content::WebContents* web_contents) | 89 content::WebContents* web_contents) |
89 : ManagePasswordsUIController(web_contents), | 90 : ManagePasswordsUIController(web_contents), |
90 run_loop_(nullptr), | 91 run_loop_(nullptr), |
91 target_state_(password_manager::ui::INACTIVE_STATE) { | 92 target_state_(password_manager::ui::INACTIVE_STATE) { |
92 // Attach CustomManagePasswordsUIController to |web_contents| so the default | 93 // Attach CustomManagePasswordsUIController to |web_contents| so the default |
93 // ManagePasswordsUIController isn't created. | 94 // ManagePasswordsUIController isn't created. |
94 // Do not silently replace an existing ManagePasswordsUIController because it | 95 // Do not silently replace an existing ManagePasswordsUIController because it |
95 // unregisters itself in WebContentsDestroyed(). | 96 // unregisters itself in WebContentsDestroyed(). |
96 EXPECT_FALSE(web_contents->GetUserData(UserDataKey())); | 97 EXPECT_FALSE(web_contents->GetUserData(UserDataKey())); |
97 web_contents->SetUserData(UserDataKey(), this); | 98 web_contents->SetUserData(UserDataKey(), base::WrapUnique(this)); |
98 } | 99 } |
99 | 100 |
100 void CustomManagePasswordsUIController::WaitForState( | 101 void CustomManagePasswordsUIController::WaitForState( |
101 password_manager::ui::State target_state) { | 102 password_manager::ui::State target_state) { |
102 base::RunLoop run_loop; | 103 base::RunLoop run_loop; |
103 target_state_ = target_state; | 104 target_state_ = target_state; |
104 run_loop_ = &run_loop; | 105 run_loop_ = &run_loop; |
105 run_loop_->Run(); | 106 run_loop_->Run(); |
106 } | 107 } |
107 | 108 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 465 |
465 content::BrowserThread::PostTaskAndReply( | 466 content::BrowserThread::PostTaskAndReply( |
466 content::BrowserThread::IO, FROM_HERE, | 467 content::BrowserThread::IO, FROM_HERE, |
467 base::BindOnce( | 468 base::BindOnce( |
468 &AddHSTSHostImpl, | 469 &AddHSTSHostImpl, |
469 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), | 470 make_scoped_refptr(browser()->profile()->GetRequestContext()), host), |
470 run_loop.QuitClosure()); | 471 run_loop.QuitClosure()); |
471 | 472 |
472 run_loop.Run(); | 473 run_loop.Run(); |
473 } | 474 } |
OLD | NEW |