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 "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
22 #include "content/public/browser/cert_store.h" | 22 #include "content/public/browser/cert_store.h" |
23 #include "content/public/common/ssl_status.h" | 23 #include "content/public/common/ssl_status.h" |
24 #include "net/cert/cert_status_flags.h" | 24 #include "net/cert/cert_status_flags.h" |
25 #include "net/cert/x509_certificate.h" | 25 #include "net/cert/x509_certificate.h" |
26 #include "net/ssl/ssl_connection_status_flags.h" | 26 #include "net/ssl/ssl_connection_status_flags.h" |
27 #include "net/test/test_certificate_data.h" | 27 #include "net/test/test_certificate_data.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 | 30 |
31 #if defined(OS_CHROMEOS) | |
32 #include "chrome/browser/chromeos/policy/network_policy_service_factory.h" | |
33 #endif | |
34 | |
31 using content::SSLStatus; | 35 using content::SSLStatus; |
32 using testing::_; | 36 using testing::_; |
33 using testing::AnyNumber; | 37 using testing::AnyNumber; |
34 using testing::Return; | 38 using testing::Return; |
35 using testing::SetArgPointee; | 39 using testing::SetArgPointee; |
36 | 40 |
37 namespace { | 41 namespace { |
38 | 42 |
39 // SSL cipher suite like specified in RFC5246 Appendix A.5. "The Cipher Suite". | 43 // SSL cipher suite like specified in RFC5246 Appendix A.5. "The Cipher Suite". |
40 // Without the CR_ prefix, this clashes with the OS X 10.8 headers. | 44 // Without the CR_ prefix, this clashes with the OS X 10.8 headers. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 | 78 |
75 class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { | 79 class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness { |
76 public: | 80 public: |
77 WebsiteSettingsTest() : cert_id_(0), url_("http://www.example.com") {} | 81 WebsiteSettingsTest() : cert_id_(0), url_("http://www.example.com") {} |
78 | 82 |
79 virtual ~WebsiteSettingsTest() { | 83 virtual ~WebsiteSettingsTest() { |
80 } | 84 } |
81 | 85 |
82 virtual void SetUp() { | 86 virtual void SetUp() { |
83 ChromeRenderViewHostTestHarness::SetUp(); | 87 ChromeRenderViewHostTestHarness::SetUp(); |
88 | |
89 #if defined(OS_CHROMEOS) | |
90 policy::NetworkPolicyServiceFactory::GetInstance()->SetTestingFactory( | |
91 profile(), NULL); | |
92 #endif | |
Joao da Silva
2013/11/11 12:38:19
Same
pneubeck (no reviews)
2013/11/12 10:07:53
Done.
| |
93 | |
84 // Setup stub SSLStatus. | 94 // Setup stub SSLStatus. |
85 ssl_.security_style = content::SECURITY_STYLE_UNAUTHENTICATED; | 95 ssl_.security_style = content::SECURITY_STYLE_UNAUTHENTICATED; |
86 | 96 |
87 // Create the certificate. | 97 // Create the certificate. |
88 cert_id_ = 1; | 98 cert_id_ = 1; |
89 base::Time start_date = base::Time::Now(); | 99 base::Time start_date = base::Time::Now(); |
90 base::Time expiration_date = base::Time::FromInternalValue( | 100 base::Time expiration_date = base::Time::FromInternalValue( |
91 start_date.ToInternalValue() + base::Time::kMicrosecondsPerWeek); | 101 start_date.ToInternalValue() + base::Time::kMicrosecondsPerWeek); |
92 cert_ = new net::X509Certificate("subject", | 102 cert_ = new net::X509Certificate("subject", |
93 "issuer", | 103 "issuer", |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); | 400 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); |
391 website_settings()->OnUIClosing(); | 401 website_settings()->OnUIClosing(); |
392 ASSERT_EQ(1u, infobar_service()->infobar_count()); | 402 ASSERT_EQ(1u, infobar_service()->infobar_count()); |
393 | 403 |
394 // Removing an |InfoBarDelegate| from the |InfoBarService| does not delete | 404 // Removing an |InfoBarDelegate| from the |InfoBarService| does not delete |
395 // it. Hence the |delegate| must be cleaned up after it was removed from the | 405 // it. Hence the |delegate| must be cleaned up after it was removed from the |
396 // |infobar_service|. | 406 // |infobar_service|. |
397 scoped_ptr<InfoBarDelegate> delegate(infobar_service()->infobar_at(0)); | 407 scoped_ptr<InfoBarDelegate> delegate(infobar_service()->infobar_at(0)); |
398 infobar_service()->RemoveInfoBar(delegate.get()); | 408 infobar_service()->RemoveInfoBar(delegate.get()); |
399 } | 409 } |
OLD | NEW |