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

Side by Side Diff: net/ssl/ssl_config_service_unittest.cc

Issue 2723783002: Make SSLConfigManager notify clients if the SHA-1 policy changes (Closed)
Patch Set: more fixes Created 3 years, 9 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
« net/ssl/ssl_config_service.cc ('K') | « net/ssl/ssl_config_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/ssl/ssl_config_service.h" 5 #include "net/ssl/ssl_config_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(0); 59 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(0);
60 mock_service->SetSSLConfig(initial_config); 60 mock_service->SetSSLConfig(initial_config);
61 61
62 mock_service->RemoveObserver(&observer); 62 mock_service->RemoveObserver(&observer);
63 } 63 }
64 64
65 TEST(SSLConfigServiceTest, ConfigUpdatesNotifyObservers) { 65 TEST(SSLConfigServiceTest, ConfigUpdatesNotifyObservers) {
66 SSLConfig initial_config; 66 SSLConfig initial_config;
67 initial_config.rev_checking_enabled = true; 67 initial_config.rev_checking_enabled = true;
68 initial_config.rev_checking_required_local_anchors = false;
69 initial_config.sha1_local_anchors_enabled = true;
68 initial_config.false_start_enabled = false; 70 initial_config.false_start_enabled = false;
69 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1; 71 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1;
70 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; 72 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2;
71 73
72 scoped_refptr<MockSSLConfigService> mock_service( 74 scoped_refptr<MockSSLConfigService> mock_service(
73 new MockSSLConfigService(initial_config)); 75 new MockSSLConfigService(initial_config));
74 MockSSLConfigServiceObserver observer; 76 MockSSLConfigServiceObserver observer;
75 mock_service->AddObserver(&observer); 77 mock_service->AddObserver(&observer);
76 78
77 // Test that the basic boolean preferences trigger updates. 79 // Test that the basic boolean preferences trigger updates.
78 initial_config.rev_checking_enabled = false; 80 initial_config.rev_checking_enabled = false;
79 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 81 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
80 mock_service->SetSSLConfig(initial_config); 82 mock_service->SetSSLConfig(initial_config);
81 83
84 initial_config.rev_checking_required_local_anchors = true;
85 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
86 mock_service->SetSSLConfig(initial_config);
87
88 initial_config.sha1_local_anchors_enabled = false;
89 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
90 mock_service->SetSSLConfig(initial_config);
91
82 initial_config.false_start_enabled = true; 92 initial_config.false_start_enabled = true;
83 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 93 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
84 mock_service->SetSSLConfig(initial_config); 94 mock_service->SetSSLConfig(initial_config);
85 95
86 // Test that changing the SSL version range triggers updates. 96 // Test that changing the SSL version range triggers updates.
87 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1; 97 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1;
88 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 98 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
89 mock_service->SetSSLConfig(initial_config); 99 mock_service->SetSSLConfig(initial_config);
90 100
91 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1; 101 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1;
(...skipping 20 matching lines...) Expand all
112 // cipher suites disabled, triggers an update. 122 // cipher suites disabled, triggers an update.
113 disabled_ciphers.pop_back(); 123 disabled_ciphers.pop_back();
114 initial_config.disabled_cipher_suites = disabled_ciphers; 124 initial_config.disabled_cipher_suites = disabled_ciphers;
115 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 125 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
116 mock_service->SetSSLConfig(initial_config); 126 mock_service->SetSSLConfig(initial_config);
117 127
118 mock_service->RemoveObserver(&observer); 128 mock_service->RemoveObserver(&observer);
119 } 129 }
120 130
121 } // namespace net 131 } // namespace net
OLDNEW
« net/ssl/ssl_config_service.cc ('K') | « net/ssl/ssl_config_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698