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..b60d24f363f2c39baf63a9f17c58ccf65c000f67 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); |
| @@ -97,10 +104,16 @@ TEST(DiskCacheBasedQuicServerInfo, Update) { |
| quic_server_info->Start(); |
| rv = quic_server_info->WaitForDataReady(callback.callback()); |
| EXPECT_EQ(net::OK, callback.GetResult(rv)); |
| + state = quic_server_info->mutable_state(); |
|
wtc
2014/02/07 00:54:11
1. We don't need mutable_state() here. We can just
ramant (doing other things)
2014/02/07 20:30:51
Done.
|
| + EXPECT_TRUE(quic_server_info->data_loaded()); |
| + EXPECT_EQ(2U, state->certs_.size()); |
| + EXPECT_EQ(server_config_a, state->server_config_); |
| + EXPECT_EQ(source_address_token_a, state->source_address_token_); |
| + EXPECT_EQ(server_config_sig_a, state->server_config_sig_); |
| + EXPECT_EQ(cert_a, state->certs_[0]); |
| + EXPECT_EQ(cert_b, state->certs_[1]); |
| state = quic_server_info->mutable_state(); |
|
wtc
2014/02/07 00:54:11
Remove this line.
ramant (doing other things)
2014/02/07 20:30:51
Done.
|
| - // TODO(rtenneti): Flesh out details of net::QuicServerInfo::State. |
| - // Verify the data after we implement save and restore of the data. |
| RemoveMockTransaction(&kHostInfoTransaction); |
| } |