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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 private: | 80 private: |
81 typedef std::map<std::string, DefaultChannelIDStore::ChannelID> | 81 typedef std::map<std::string, DefaultChannelIDStore::ChannelID> |
82 ChannelIDMap; | 82 ChannelIDMap; |
83 | 83 |
84 ChannelIDMap channel_ids_; | 84 ChannelIDMap channel_ids_; |
85 }; | 85 }; |
86 | 86 |
87 MockPersistentStore::MockPersistentStore() {} | 87 MockPersistentStore::MockPersistentStore() {} |
88 | 88 |
89 void MockPersistentStore::Load(const LoadedCallback& loaded_callback) { | 89 void MockPersistentStore::Load(const LoadedCallback& loaded_callback) { |
90 scoped_ptr<ScopedVector<DefaultChannelIDStore::ChannelID> > | 90 scoped_ptr<std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>>> |
91 channel_ids(new ScopedVector<DefaultChannelIDStore::ChannelID>()); | 91 channel_ids( |
| 92 new std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>>()); |
92 ChannelIDMap::iterator it; | 93 ChannelIDMap::iterator it; |
93 | 94 |
94 for (it = channel_ids_.begin(); it != channel_ids_.end(); ++it) { | 95 for (it = channel_ids_.begin(); it != channel_ids_.end(); ++it) { |
95 channel_ids->push_back( | 96 channel_ids->push_back( |
96 new DefaultChannelIDStore::ChannelID(it->second)); | 97 make_scoped_ptr(new DefaultChannelIDStore::ChannelID(it->second))); |
97 } | 98 } |
98 | 99 |
99 base::ThreadTaskRunnerHandle::Get()->PostTask( | 100 base::ThreadTaskRunnerHandle::Get()->PostTask( |
100 FROM_HERE, base::Bind(loaded_callback, base::Passed(&channel_ids))); | 101 FROM_HERE, base::Bind(loaded_callback, base::Passed(&channel_ids))); |
101 } | 102 } |
102 | 103 |
103 void MockPersistentStore::AddChannelID( | 104 void MockPersistentStore::AddChannelID( |
104 const DefaultChannelIDStore::ChannelID& channel_id) { | 105 const DefaultChannelIDStore::ChannelID& channel_id) { |
105 channel_ids_[channel_id.server_identifier()] = channel_id; | 106 channel_ids_[channel_id.server_identifier()] = channel_id; |
106 } | 107 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 ++channel_id; | 453 ++channel_id; |
453 EXPECT_EQ("copied.com", channel_id->server_identifier()); | 454 EXPECT_EQ("copied.com", channel_id->server_identifier()); |
454 EXPECT_TRUE(KeysEqual(copied_key.get(), channel_id->key())); | 455 EXPECT_TRUE(KeysEqual(copied_key.get(), channel_id->key())); |
455 | 456 |
456 ++channel_id; | 457 ++channel_id; |
457 EXPECT_EQ("preexisting.com", channel_id->server_identifier()); | 458 EXPECT_EQ("preexisting.com", channel_id->server_identifier()); |
458 EXPECT_TRUE(KeysEqual(preexisting_key.get(), channel_id->key())); | 459 EXPECT_TRUE(KeysEqual(preexisting_key.get(), channel_id->key())); |
459 } | 460 } |
460 | 461 |
461 } // namespace net | 462 } // namespace net |
OLD | NEW |