| 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..4e4591f8da373a08a4d033c64e49373fb58c542d 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(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(2U, state1.certs.size());
|
| + EXPECT_EQ(cert_a, state1.certs[0]);
|
| + EXPECT_EQ(cert_b, state1.certs[1]);
|
|
|
| RemoveMockTransaction(&kHostInfoTransaction);
|
| }
|
|
|