Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2313)

Unified Diff: net/spdy/spdy_session_spdy3_unittest.cc

Issue 11415219: Move a number of static variables SPDY to HttpNetworkSession::Params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar cleanup Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_session_spdy3_unittest.cc
diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc
index e03156d5d931151bfa1687ba85c740c0c712e4f1..aab0c9c2c7ecf01f281cb817f75d6fd6878fc728 100644
--- a/net/spdy/spdy_session_spdy3_unittest.cc
+++ b/net/spdy/spdy_session_spdy3_unittest.cc
@@ -21,9 +21,9 @@ namespace net {
namespace {
+static int g_delta_seconds = 0;
base::TimeTicks the_near_future() {
- return base::TimeTicks::Now() +
- base::TimeDelta::FromSeconds(301);
+ return base::TimeTicks::Now() + base::TimeDelta::FromSeconds(g_delta_seconds);
}
class ClosingDelegate : public SpdyStream::Delegate {
@@ -99,17 +99,9 @@ class TestSpdyStreamDelegate : public SpdyStream::Delegate {
} // namespace
-// TODO(cbentzel): Expose compression setter/getter in public SpdySession
-// interface rather than going through all these contortions.
class SpdySessionSpdy3Test : public PlatformTest {
- protected:
- virtual void SetUp() {
- SpdySession::set_default_protocol(kProtoSPDY3);
- }
-
- private:
- SpdyTestStateHelper spdy_state_;
};
+
// Test the SpdyIOBuffer class.
TEST_F(SpdySessionSpdy3Test, SpdyIOBuffer) {
std::priority_queue<SpdyIOBuffer> queue_;
@@ -208,6 +200,7 @@ TEST_F(SpdySessionSpdy3Test, GoAway) {
TEST_F(SpdySessionSpdy3Test, ClientPing) {
SpdySessionDependencies session_deps;
+ session_deps.enable_ping = true;
session_deps.host_resolver->set_synchronous_mode(true);
MockConnect connect_data(SYNCHRONOUS, OK);
@@ -272,8 +265,6 @@ TEST_F(SpdySessionSpdy3Test, ClientPing) {
base::TimeTicks before_ping_time = base::TimeTicks::Now();
- // Enable sending of PING.
- SpdySession::set_enable_ping_based_connection_checking(true);
session->set_connection_at_risk_of_loss_time(base::TimeDelta::FromSeconds(0));
session->set_hung_interval(base::TimeDelta::FromMilliseconds(50));
@@ -373,6 +364,7 @@ TEST_F(SpdySessionSpdy3Test, DeleteExpiredPushStreams) {
SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
session_deps.socket_factory->AddSSLSocketDataProvider(&ssl);
+ session_deps.time_func = the_near_future;
willchan no longer on Chromium 2012/12/01 20:49:13 Should probably still be CamelCased. Mind changing
Ryan Hamilton 2012/12/01 23:02:25 Done.
scoped_refptr<HttpNetworkSession> http_session(
SpdySessionDependencies::SpdyCreateSession(&session_deps));
@@ -389,7 +381,7 @@ TEST_F(SpdySessionSpdy3Test, DeleteExpiredPushStreams) {
EXPECT_TRUE(spdy_session_pool->HasSession(pair));
// Give the session a SPDY3 framer.
- session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(3));
+ session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(3, false));
// Create the associated stream and add to active streams.
scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock);
@@ -415,7 +407,7 @@ TEST_F(SpdySessionSpdy3Test, DeleteExpiredPushStreams) {
EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter);
// Shift time.
- SpdySession::set_time_func(the_near_future);
+ g_delta_seconds = 301;
willchan no longer on Chromium 2012/12/01 20:49:13 Strange that we're setting a global here in a sing
Ryan Hamilton 2012/12/01 23:02:25 I agree that it's weird :< Happy to refactor it,
willchan no longer on Chromium 2012/12/01 23:05:53 Can we just hardcode it to 301? IIUC, we only ever
headers[":scheme"] = "http";
headers[":host"] = "www.google.com";
@@ -495,8 +487,6 @@ TEST_F(SpdySessionSpdy3Test, FailedPing) {
new TestSpdyStreamDelegate(callback1.callback()));
spdy_stream1->SetDelegate(delegate.get());
- // Enable sending of PING.
- SpdySession::set_enable_ping_based_connection_checking(true);
session->set_connection_at_risk_of_loss_time(base::TimeDelta::FromSeconds(0));
session->set_hung_interval(base::TimeDelta::FromSeconds(0));
@@ -867,7 +857,7 @@ TEST_F(SpdySessionSpdy3Test, SendInitialSettingsOnNewSession) {
MockWrite writes[] = {
CreateMockWrite(*settings_frame),
};
- SpdySession::set_default_initial_recv_window_size(kInitialRecvWindowSize);
+ session_deps.initial_recv_window_size = kInitialRecvWindowSize;
StaticSocketDataProvider data(
reads, arraysize(reads), writes, arraysize(writes));

Powered by Google App Engine
This is Rietveld 408576698