| OLD | NEW |
| 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/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "components/infobars/core/infobar.h" | 26 #include "components/infobars/core/infobar.h" |
| 27 #include "content/public/browser/cert_store.h" | 27 #include "content/public/browser/cert_store.h" |
| 28 #include "content/public/common/ssl_status.h" | 28 #include "content/public/common/ssl_status.h" |
| 29 #include "device/core/mock_device_client.h" | 29 #include "device/core/mock_device_client.h" |
| 30 #include "device/usb/mock_usb_device.h" | 30 #include "device/usb/mock_usb_device.h" |
| 31 #include "device/usb/mock_usb_service.h" | 31 #include "device/usb/mock_usb_service.h" |
| 32 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 33 #include "net/cert/cert_status_flags.h" | 33 #include "net/cert/cert_status_flags.h" |
| 34 #include "net/cert/x509_certificate.h" | 34 #include "net/cert/x509_certificate.h" |
| 35 #include "net/ssl/ssl_connection_status_flags.h" | 35 #include "net/ssl/ssl_connection_status_flags.h" |
| 36 #include "net/test/cert_test_util.h" |
| 36 #include "net/test/test_certificate_data.h" | 37 #include "net/test/test_certificate_data.h" |
| 38 #include "net/test/test_data_directory.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 39 | 41 |
| 40 using content::SSLStatus; | 42 using content::SSLStatus; |
| 41 using security_state::SecurityStateModel; | 43 using security_state::SecurityStateModel; |
| 42 using testing::_; | 44 using testing::_; |
| 43 using testing::AnyNumber; | 45 using testing::AnyNumber; |
| 44 using testing::Invoke; | 46 using testing::Invoke; |
| 45 using testing::Return; | 47 using testing::Return; |
| 46 using testing::SetArgPointee; | 48 using testing::SetArgPointee; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ~WebsiteSettingsTest() override {} | 92 ~WebsiteSettingsTest() override {} |
| 91 | 93 |
| 92 void SetUp() override { | 94 void SetUp() override { |
| 93 ChromeRenderViewHostTestHarness::SetUp(); | 95 ChromeRenderViewHostTestHarness::SetUp(); |
| 94 | 96 |
| 95 // Setup stub SSLStatus. | 97 // Setup stub SSLStatus. |
| 96 security_info_.security_level = SecurityStateModel::NONE; | 98 security_info_.security_level = SecurityStateModel::NONE; |
| 97 | 99 |
| 98 // Create the certificate. | 100 // Create the certificate. |
| 99 cert_id_ = 1; | 101 cert_id_ = 1; |
| 100 base::Time start_date = base::Time::Now(); | 102 cert_ = |
| 101 base::Time expiration_date = base::Time::FromInternalValue( | 103 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem"); |
| 102 start_date.ToInternalValue() + base::Time::kMicrosecondsPerWeek); | 104 ASSERT_TRUE(cert_); |
| 103 cert_ = new net::X509Certificate("subject", | |
| 104 "issuer", | |
| 105 start_date, | |
| 106 expiration_date); | |
| 107 | 105 |
| 108 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 106 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
| 109 InfoBarService::CreateForWebContents(web_contents()); | 107 InfoBarService::CreateForWebContents(web_contents()); |
| 110 | 108 |
| 111 // Setup the mock cert store. | 109 // Setup the mock cert store. |
| 112 EXPECT_CALL(cert_store_, RetrieveCert(cert_id_, _) ) | 110 EXPECT_CALL(cert_store_, RetrieveCert(cert_id_, _) ) |
| 113 .Times(AnyNumber()) | 111 .Times(AnyNumber()) |
| 114 .WillRepeatedly(DoAll(SetArgPointee<1>(cert_), Return(true))); | 112 .WillRepeatedly(DoAll(SetArgPointee<1>(cert_), Return(true))); |
| 115 | 113 |
| 116 // Setup mock ui. | 114 // Setup mock ui. |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 785 |
| 788 TEST_F(WebsiteSettingsTest, InternalPage) { | 786 TEST_F(WebsiteSettingsTest, InternalPage) { |
| 789 SetURL("chrome://bookmarks"); | 787 SetURL("chrome://bookmarks"); |
| 790 SetDefaultUIExpectations(mock_ui()); | 788 SetDefaultUIExpectations(mock_ui()); |
| 791 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, | 789 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, |
| 792 website_settings()->site_connection_status()); | 790 website_settings()->site_connection_status()); |
| 793 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, | 791 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, |
| 794 website_settings()->site_identity_status()); | 792 website_settings()->site_identity_status()); |
| 795 EXPECT_EQ(base::string16(), website_settings()->organization_name()); | 793 EXPECT_EQ(base::string16(), website_settings()->organization_name()); |
| 796 } | 794 } |
| OLD | NEW |