Add option to simulate alternate protocol always being present.
It's a bit hardcoded (port 443, NPN/SPDY2), but it is just for
testing purposes.

To use this mode, run chrome with:
   chrome.exe --use-spdy=npn,force-alt-protocols

BUG=none
TEST=http_alternate_protocols_unittest.cc

Review URL: http://codereview.chromium.org/3195015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57022 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 24c410e..95f9ea9 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -148,6 +148,7 @@
   static const char kDisableCompression[] = "no-compress";
   static const char kDisableAltProtocols[] = "no-alt-protocols";
   static const char kEnableVersionOne[] = "v1";
+  static const char kForceAltProtocols[] = "force-alt-protocols";
 
   // If flow-control is enabled, received WINDOW_UPDATE and SETTINGS
   // messages are processed and outstanding window size is actually obeyed
@@ -210,6 +211,11 @@
       HttpStreamFactory::set_use_alternate_protocols(false);
     } else if (option == kEnableFlowControl) {
       SpdySession::SetFlowControl(true);
+    } else if (option == kForceAltProtocols) {
+      HttpAlternateProtocols::PortProtocolPair pair;
+      pair.port = 443;
+      pair.protocol = HttpAlternateProtocols::NPN_SPDY_2;
+      HttpAlternateProtocols::ForceAlternateProtocol(pair);
     } else if (option.empty() && it == spdy_options.begin()) {
       continue;
     } else {