| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/default_channel_id_store.h" | 5 #include "net/ssl/default_channel_id_store.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 public: | 73 public: |
| 74 MockPersistentStore(); | 74 MockPersistentStore(); |
| 75 | 75 |
| 76 // DefaultChannelIDStore::PersistentStore implementation. | 76 // DefaultChannelIDStore::PersistentStore implementation. |
| 77 void Load(const LoadedCallback& loaded_callback) override; | 77 void Load(const LoadedCallback& loaded_callback) override; |
| 78 void AddChannelID( | 78 void AddChannelID( |
| 79 const DefaultChannelIDStore::ChannelID& channel_id) override; | 79 const DefaultChannelIDStore::ChannelID& channel_id) override; |
| 80 void DeleteChannelID( | 80 void DeleteChannelID( |
| 81 const DefaultChannelIDStore::ChannelID& channel_id) override; | 81 const DefaultChannelIDStore::ChannelID& channel_id) override; |
| 82 void SetForceKeepSessionState() override; | 82 void SetForceKeepSessionState() override; |
| 83 void Flush() override; |
| 83 | 84 |
| 84 protected: | 85 protected: |
| 85 ~MockPersistentStore() override; | 86 ~MockPersistentStore() override; |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 typedef std::map<std::string, DefaultChannelIDStore::ChannelID> | 89 typedef std::map<std::string, DefaultChannelIDStore::ChannelID> |
| 89 ChannelIDMap; | 90 ChannelIDMap; |
| 90 | 91 |
| 91 ChannelIDMap channel_ids_; | 92 ChannelIDMap channel_ids_; |
| 92 }; | 93 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 114 channel_ids_[channel_id.server_identifier()] = channel_id; | 115 channel_ids_[channel_id.server_identifier()] = channel_id; |
| 115 } | 116 } |
| 116 | 117 |
| 117 void MockPersistentStore::DeleteChannelID( | 118 void MockPersistentStore::DeleteChannelID( |
| 118 const DefaultChannelIDStore::ChannelID& channel_id) { | 119 const DefaultChannelIDStore::ChannelID& channel_id) { |
| 119 channel_ids_.erase(channel_id.server_identifier()); | 120 channel_ids_.erase(channel_id.server_identifier()); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void MockPersistentStore::SetForceKeepSessionState() {} | 123 void MockPersistentStore::SetForceKeepSessionState() {} |
| 123 | 124 |
| 125 void MockPersistentStore::Flush() {} |
| 126 |
| 124 MockPersistentStore::~MockPersistentStore() {} | 127 MockPersistentStore::~MockPersistentStore() {} |
| 125 | 128 |
| 126 bool DomainEquals(const std::string& domain1, const std::string& domain2) { | 129 bool DomainEquals(const std::string& domain1, const std::string& domain2) { |
| 127 return domain1 == domain2; | 130 return domain1 == domain2; |
| 128 } | 131 } |
| 129 | 132 |
| 130 bool DomainNotEquals(const std::string& domain1, const std::string& domain2) { | 133 bool DomainNotEquals(const std::string& domain1, const std::string& domain2) { |
| 131 return !DomainEquals(domain1, domain2); | 134 return !DomainEquals(domain1, domain2); |
| 132 } | 135 } |
| 133 | 136 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 ++channel_id; | 498 ++channel_id; |
| 496 EXPECT_EQ("copied.com", channel_id->server_identifier()); | 499 EXPECT_EQ("copied.com", channel_id->server_identifier()); |
| 497 EXPECT_TRUE(KeysEqual(copied_key.get(), channel_id->key())); | 500 EXPECT_TRUE(KeysEqual(copied_key.get(), channel_id->key())); |
| 498 | 501 |
| 499 ++channel_id; | 502 ++channel_id; |
| 500 EXPECT_EQ("preexisting.com", channel_id->server_identifier()); | 503 EXPECT_EQ("preexisting.com", channel_id->server_identifier()); |
| 501 EXPECT_TRUE(KeysEqual(preexisting_key.get(), channel_id->key())); | 504 EXPECT_TRUE(KeysEqual(preexisting_key.get(), channel_id->key())); |
| 502 } | 505 } |
| 503 | 506 |
| 504 } // namespace net | 507 } // namespace net |
| OLD | NEW |