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

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

Issue 2730623005: Make SSLConfigManager notify clients if the SHA-1 policy changes (Closed)
Patch Set: 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
« no previous file with comments | « 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;
71 initial_config.require_ecdhe = false;
69 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1; 72 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1;
70 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; 73 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2;
71 74
72 scoped_refptr<MockSSLConfigService> mock_service( 75 scoped_refptr<MockSSLConfigService> mock_service(
73 new MockSSLConfigService(initial_config)); 76 new MockSSLConfigService(initial_config));
74 MockSSLConfigServiceObserver observer; 77 MockSSLConfigServiceObserver observer;
75 mock_service->AddObserver(&observer); 78 mock_service->AddObserver(&observer);
76 79
77 // Test that the basic boolean preferences trigger updates. 80 // Test that the basic boolean preferences trigger updates.
78 initial_config.rev_checking_enabled = false; 81 initial_config.rev_checking_enabled = false;
79 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 82 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
80 mock_service->SetSSLConfig(initial_config); 83 mock_service->SetSSLConfig(initial_config);
81 84
85 initial_config.rev_checking_required_local_anchors = true;
86 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
87 mock_service->SetSSLConfig(initial_config);
88
89 initial_config.sha1_local_anchors_enabled = false;
90 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
91 mock_service->SetSSLConfig(initial_config);
92
82 initial_config.false_start_enabled = true; 93 initial_config.false_start_enabled = true;
83 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 94 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
84 mock_service->SetSSLConfig(initial_config); 95 mock_service->SetSSLConfig(initial_config);
85 96
97 initial_config.require_ecdhe = true;
98 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
99 mock_service->SetSSLConfig(initial_config);
100
86 // Test that changing the SSL version range triggers updates. 101 // Test that changing the SSL version range triggers updates.
87 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1; 102 initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1;
88 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 103 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
89 mock_service->SetSSLConfig(initial_config); 104 mock_service->SetSSLConfig(initial_config);
90 105
91 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1; 106 initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1;
92 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 107 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
93 mock_service->SetSSLConfig(initial_config); 108 mock_service->SetSSLConfig(initial_config);
94 109
95 // Test that disabling certain cipher suites triggers an update. 110 // Test that disabling certain cipher suites triggers an update.
(...skipping 16 matching lines...) Expand all
112 // cipher suites disabled, triggers an update. 127 // cipher suites disabled, triggers an update.
113 disabled_ciphers.pop_back(); 128 disabled_ciphers.pop_back();
114 initial_config.disabled_cipher_suites = disabled_ciphers; 129 initial_config.disabled_cipher_suites = disabled_ciphers;
115 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); 130 EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1);
116 mock_service->SetSSLConfig(initial_config); 131 mock_service->SetSSLConfig(initial_config);
117 132
118 mock_service->RemoveObserver(&observer); 133 mock_service->RemoveObserver(&observer);
119 } 134 }
120 135
121 } // namespace net 136 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_config_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698