| 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/ui/views/certificate_selector.h" | 5 #include "chrome/browser/ui/views/certificate_selector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 TestCertificateSelector(const net::CertificateList& certificates, | 29 TestCertificateSelector(const net::CertificateList& certificates, |
| 30 content::WebContents* web_contents) | 30 content::WebContents* web_contents) |
| 31 : CertificateSelector(certificates, web_contents) {} | 31 : CertificateSelector(certificates, web_contents) {} |
| 32 | 32 |
| 33 ~TestCertificateSelector() override { | 33 ~TestCertificateSelector() override { |
| 34 if (!on_destroy_.is_null()) | 34 if (!on_destroy_.is_null()) |
| 35 on_destroy_.Run(); | 35 on_destroy_.Run(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void Init() { | 38 void Init() { |
| 39 InitWithText(base::WrapUnique( | 39 InitWithText(base::MakeUnique<views::Label>( |
| 40 new views::Label(base::ASCIIToUTF16("some arbitrary text")))); | 40 base::ASCIIToUTF16("some arbitrary text"))); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool Accept() override { | 43 bool Accept() override { |
| 44 if (accepted_) | 44 if (accepted_) |
| 45 *accepted_ = true; | 45 *accepted_ = true; |
| 46 return CertificateSelector::Accept(); | 46 return CertificateSelector::Accept(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool Cancel() override { | 49 bool Cancel() override { |
| 50 if (canceled_) | 50 if (canceled_) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 selector_->OnDoubleClick(); | 149 selector_->OnDoubleClick(); |
| 150 | 150 |
| 151 // Wait for the dialog to be closed and destroyed. | 151 // Wait for the dialog to be closed and destroyed. |
| 152 loop.Run(); | 152 loop.Run(); |
| 153 | 153 |
| 154 // Closing the dialog through a double click must call only the Accept() | 154 // Closing the dialog through a double click must call only the Accept() |
| 155 // function and not Cancel(). | 155 // function and not Cancel(). |
| 156 EXPECT_TRUE(accepted); | 156 EXPECT_TRUE(accepted); |
| 157 EXPECT_FALSE(canceled); | 157 EXPECT_FALSE(canceled); |
| 158 } | 158 } |
| OLD | NEW |