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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h " 5 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 13 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
13 #include "components/autofill/core/browser/suggestion.h" 14 #include "components/autofill/core/browser/suggestion.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/platform_test.h" 17 #include "testing/platform_test.h"
17 #include "ui/gfx/font_list.h" 18 #include "ui/gfx/font_list.h"
18 #include "ui/gfx/geometry/rect_f.h" 19 #include "ui/gfx/geometry/rect_f.h"
19 #include "ui/gfx/range/range.h" 20 #include "ui/gfx/range/range.h"
20 21
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 initWithController:mock_controller_.get() 89 initWithController:mock_controller_.get()
89 frame:NSZeroRect]); 90 frame:NSZeroRect]);
90 91
91 NSView* contentView = [test_window() contentView]; 92 NSView* contentView = [test_window() contentView];
92 [contentView addSubview:view_]; 93 [contentView addSubview:view_];
93 EXPECT_CALL(*mock_controller_, container_view()) 94 EXPECT_CALL(*mock_controller_, container_view())
94 .WillRepeatedly(Return(contentView)); 95 .WillRepeatedly(Return(contentView));
95 } 96 }
96 97
97 base::string16 password_; 98 base::string16 password_;
98 scoped_ptr<MockPasswordGenerationPopupController> mock_controller_; 99 std::unique_ptr<MockPasswordGenerationPopupController> mock_controller_;
99 base::scoped_nsobject<PasswordGenerationPopupViewCocoa> view_; 100 base::scoped_nsobject<PasswordGenerationPopupViewCocoa> view_;
100 }; 101 };
101 102
102 TEST_VIEW(PasswordGenerationPopupViewCocoaTest, view_); 103 TEST_VIEW(PasswordGenerationPopupViewCocoaTest, view_);
103 104
104 TEST_F(PasswordGenerationPopupViewCocoaTest, ShowAndHide) { 105 TEST_F(PasswordGenerationPopupViewCocoaTest, ShowAndHide) {
105 // Verify that the view fetches a password from the controller. 106 // Verify that the view fetches a password from the controller.
106 EXPECT_CALL(*mock_controller_, password()).Times(AtLeast(1)) 107 EXPECT_CALL(*mock_controller_, password()).Times(AtLeast(1))
107 .WillRepeatedly(Return(password_)); 108 .WillRepeatedly(Return(password_));
108 109
(...skipping 10 matching lines...) Expand all
119 // popup is hidden. 120 // popup is hidden.
120 TEST_F(PasswordGenerationPopupViewCocoaTest, ControllerDestroyed) { 121 TEST_F(PasswordGenerationPopupViewCocoaTest, ControllerDestroyed) {
121 [view_ showPopup]; 122 [view_ showPopup];
122 mock_controller_.reset(); 123 mock_controller_.reset();
123 [view_ controllerDestroyed]; 124 [view_ controllerDestroyed];
124 [view_ display]; 125 [view_ display];
125 [view_ hidePopup]; 126 [view_ hidePopup];
126 } 127 }
127 128
128 } // namespace 129 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698