Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1260)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc

Issue 2847173004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <map> 5 #include <map>
6 #include <memory> 6 #include <memory>
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bool opened_bubble_; 110 bool opened_bubble_;
111 }; 111 };
112 112
113 TestManagePasswordsUIController::TestManagePasswordsUIController( 113 TestManagePasswordsUIController::TestManagePasswordsUIController(
114 content::WebContents* contents, 114 content::WebContents* contents,
115 password_manager::PasswordManagerClient* client) 115 password_manager::PasswordManagerClient* client)
116 : ManagePasswordsUIController(contents) { 116 : ManagePasswordsUIController(contents) {
117 // Do not silently replace an existing ManagePasswordsUIController because it 117 // Do not silently replace an existing ManagePasswordsUIController because it
118 // unregisters itself in WebContentsDestroyed(). 118 // unregisters itself in WebContentsDestroyed().
119 EXPECT_FALSE(contents->GetUserData(UserDataKey())); 119 EXPECT_FALSE(contents->GetUserData(UserDataKey()));
120 contents->SetUserData(UserDataKey(), this); 120 contents->SetUserData(UserDataKey(), base::WrapUnique(this));
121 set_client(client); 121 set_client(client);
122 } 122 }
123 123
124 TestManagePasswordsUIController::~TestManagePasswordsUIController() { 124 TestManagePasswordsUIController::~TestManagePasswordsUIController() {
125 } 125 }
126 126
127 void TestManagePasswordsUIController::UpdateBubbleAndIconVisibility() { 127 void TestManagePasswordsUIController::UpdateBubbleAndIconVisibility() {
128 opened_bubble_ = IsAutomaticallyOpeningBubble(); 128 opened_bubble_ = IsAutomaticallyOpeningBubble();
129 ManagePasswordsUIController::UpdateBubbleAndIconVisibility(); 129 ManagePasswordsUIController::UpdateBubbleAndIconVisibility();
130 OnUpdateBubbleAndIconVisibility(); 130 OnUpdateBubbleAndIconVisibility();
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // Open the bubble again. 797 // Open the bubble again.
798 local_credentials.emplace_back(new autofill::PasswordForm(test_local_form())); 798 local_credentials.emplace_back(new autofill::PasswordForm(test_local_form()));
799 EXPECT_CALL(*controller(), OnUpdateBubbleAndIconVisibility()); 799 EXPECT_CALL(*controller(), OnUpdateBubbleAndIconVisibility());
800 controller()->OnAutoSignin(std::move(local_credentials), 800 controller()->OnAutoSignin(std::move(local_credentials),
801 test_local_form().origin); 801 test_local_form().origin);
802 EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, controller()->GetState()); 802 EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, controller()->GetState());
803 // Check the delegate is destroyed. Thus, the first bubble has no way to mess 803 // Check the delegate is destroyed. Thus, the first bubble has no way to mess
804 // up with the controller's state. 804 // up with the controller's state.
805 EXPECT_FALSE(proxy_delegate); 805 EXPECT_FALSE(proxy_delegate);
806 } 806 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698