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

Side by Side Diff: chrome/browser/ui/views/crypto_module_password_dialog_view_unittest.cc

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 (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 "chrome/browser/ui/views/crypto_module_password_dialog_view.h" 5 #include "chrome/browser/ui/views/crypto_module_password_dialog_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 void Capture(const std::string& text) { 22 void Capture(const std::string& text) {
23 text_ = text; 23 text_ = text;
24 } 24 }
25 25
26 void CreateCryptoDialog(const CryptoModulePasswordCallback& callback) { 26 void CreateCryptoDialog(const CryptoModulePasswordCallback& callback) {
27 dialog_.reset(new CryptoModulePasswordDialogView("slot", 27 dialog_.reset(new CryptoModulePasswordDialogView("slot",
28 kCryptoModulePasswordKeygen, "server", callback)); 28 kCryptoModulePasswordKeygen, "server", callback));
29 } 29 }
30 30
31 std::string text_; 31 std::string text_;
32 scoped_ptr<CryptoModulePasswordDialogView> dialog_; 32 std::unique_ptr<CryptoModulePasswordDialogView> dialog_;
33 }; 33 };
34 34
35 TEST_F(CryptoModulePasswordDialogViewTest, TestAccept) { 35 TEST_F(CryptoModulePasswordDialogViewTest, TestAccept) {
36 CryptoModulePasswordCallback cb( 36 CryptoModulePasswordCallback cb(
37 base::Bind(&CryptoModulePasswordDialogViewTest::Capture, 37 base::Bind(&CryptoModulePasswordDialogViewTest::Capture,
38 base::Unretained(this))); 38 base::Unretained(this)));
39 CreateCryptoDialog(cb); 39 CreateCryptoDialog(cb);
40 EXPECT_EQ(dialog_->password_entry_, dialog_->GetInitiallyFocusedView()); 40 EXPECT_EQ(dialog_->password_entry_, dialog_->GetInitiallyFocusedView());
41 EXPECT_TRUE(dialog_->GetModalType() != ui::MODAL_TYPE_NONE); 41 EXPECT_TRUE(dialog_->GetModalType() != ui::MODAL_TYPE_NONE);
42 const std::string kPassword = "diAl0g"; 42 const std::string kPassword = "diAl0g";
43 dialog_->password_entry_->SetText(base::ASCIIToUTF16(kPassword)); 43 dialog_->password_entry_->SetText(base::ASCIIToUTF16(kPassword));
44 EXPECT_TRUE(dialog_->Accept()); 44 EXPECT_TRUE(dialog_->Accept());
45 EXPECT_EQ(kPassword, text_); 45 EXPECT_EQ(kPassword, text_);
46 const base::string16 empty; 46 const base::string16 empty;
47 EXPECT_EQ(empty, dialog_->password_entry_->text()); 47 EXPECT_EQ(empty, dialog_->password_entry_->text());
48 } 48 }
49 49
50 } // namespace chrome 50 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | chrome/browser/ui/views/desktop_media_picker_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698