Chromium Code Reviews| Index: net/http/disk_cache_based_quic_server_info_unittest.cc |
| diff --git a/net/http/disk_cache_based_quic_server_info_unittest.cc b/net/http/disk_cache_based_quic_server_info_unittest.cc |
| index 9d5af3f3414ddbdc15f7fec710f22982efdf70e1..d7bbd4a288e37bf6b796977d0b03896614f3bf4c 100644 |
| --- a/net/http/disk_cache_based_quic_server_info_unittest.cc |
| +++ b/net/http/disk_cache_based_quic_server_info_unittest.cc |
| @@ -2,12 +2,13 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "net/http/disk_cache_based_quic_server_info.h" |
| + |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| #include "base/compiler_specific.h" |
| #include "base/message_loop/message_loop.h" |
| #include "net/base/net_errors.h" |
| -#include "net/http/disk_cache_based_quic_server_info.h" |
| #include "net/http/mock_http_cache.h" |
| #include "net/quic/crypto/quic_server_info.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -63,15 +64,23 @@ TEST(DiskCacheBasedQuicServerInfo, Update) { |
| EXPECT_EQ(net::OK, callback.GetResult(rv)); |
| net::QuicServerInfo::State* state = quic_server_info->mutable_state(); |
| - // TODO(rtenneti): Flesh out details of net::QuicServerInfo::State. |
| - EXPECT_TRUE(state->data.empty()); |
| - state->data.push_back(std::string("foo")); |
| + EXPECT_TRUE(state->certs_.empty()); |
| + const string server_config_a = "server_config_a"; |
| + const string source_address_token_a = "source_address_token_a"; |
| + const string server_config_sig_a = "server_config_sig_a"; |
| + const string cert_a = "cert_a"; |
| + const string cert_b = "cert_b"; |
| + |
| + state->server_config_ = server_config_a; |
| + state->source_address_token_ = source_address_token_a; |
| + state->server_config_sig_ = server_config_sig_a; |
| + state->certs_.push_back(cert_a); |
| quic_server_info->Persist(); |
| // Wait until Persist() does the work. |
| base::MessageLoop::current()->RunUntilIdle(); |
| - // Open the stored net::QuicCryptoClientConfig::CachedState. |
| + // Open the stored QuicServerInfo. |
| quic_server_info.reset( |
| new net::DiskCacheBasedQuicServerInfo("https://www.google.com", |
| cache.http_cache())); |
| @@ -81,9 +90,7 @@ TEST(DiskCacheBasedQuicServerInfo, Update) { |
| // And now update the data. |
| state = quic_server_info->mutable_state(); |
| - // TODO(rtenneti): Flesh out details of net::QuicServerInfo::State. |
| - // Verify the data after we implement save and restore of the data. |
| - state->data.push_back(std::string("bar")); |
| + state->certs_.push_back(cert_b); |
| // Fail instead of DCHECKing double creates. |
| cache.disk_cache()->set_double_create_check(false); |
| @@ -98,9 +105,14 @@ TEST(DiskCacheBasedQuicServerInfo, Update) { |
| rv = quic_server_info->WaitForDataReady(callback.callback()); |
| EXPECT_EQ(net::OK, callback.GetResult(rv)); |
| - state = quic_server_info->mutable_state(); |
| - // TODO(rtenneti): Flesh out details of net::QuicServerInfo::State. |
| - // Verify the data after we implement save and restore of the data. |
| + const net::QuicServerInfo::State& state1 = quic_server_info->state(); |
| + EXPECT_TRUE(quic_server_info->IsDataReady()); |
| + EXPECT_EQ(2U, state1.certs_.size()); |
| + EXPECT_EQ(server_config_a, state1.server_config_); |
| + EXPECT_EQ(source_address_token_a, state1.source_address_token_); |
| + EXPECT_EQ(server_config_sig_a, state1.server_config_sig_); |
| + EXPECT_EQ(cert_a, state1.certs_[0]); |
|
wtc
2014/02/11 01:01:45
Nit: move line 110 right before this line because
ramant (doing other things)
2014/02/11 07:57:55
Done.
|
| + EXPECT_EQ(cert_b, state1.certs_[1]); |
| RemoveMockTransaction(&kHostInfoTransaction); |
| } |