forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warmth of a connection (cwnd) is estimated by the amount of data writ…
…ten to the socket. Choosing the warmest connection would mean faster resource load times. idle time is the time a socket has remained idle (no http requests being served on it). Probability of server resetting a connection increases with idle time duration. Using a cost function that takes into account bytes transferred and idle time to pick best connection to schedule http requests on. CODEREVIEW done in http://codereview.chromium.org/6990036/ Contributed by gagansingh@google.com Review URL: http://codereview.chromium.org/7189055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90373 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
gagansingh@google.com
committed
Jun 24, 2011
1 parent
591805d
commit 0ca76cb
Showing
54 changed files
with
679 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) 2011 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/browser_main.h" | ||
|
||
#include <string> | ||
#include <vector> | ||
#include "base/command_line.h" | ||
#include "chrome/common/chrome_switches.h" | ||
#include "chrome/test/testing_pref_service.h" | ||
#include "content/common/main_function_params.h" | ||
#include "content/common/sandbox_init_wrapper.h" | ||
#include "net/socket/client_socket_pool_base.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
class BrowserMainTest : public testing::Test { | ||
public: | ||
BrowserMainTest() : command_line_(CommandLine::NO_PROGRAM) {} | ||
protected: | ||
virtual void SetUp() { | ||
sandbox_init_wrapper_.reset(new SandboxInitWrapper()); | ||
} | ||
|
||
scoped_ptr<SandboxInitWrapper> sandbox_init_wrapper_; | ||
TestingPrefService pref_service_; | ||
CommandLine command_line_; | ||
}; | ||
|
||
TEST_F(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket) { | ||
command_line_.AppendSwitchASCII(switches::kSocketReusePolicy, "0"); | ||
|
||
scoped_ptr<MainFunctionParams> params( | ||
new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); | ||
scoped_ptr<BrowserMainParts> bw(BrowserMainParts::CreateBrowserMainParts( | ||
*params)); | ||
|
||
bw->WarmConnectionFieldTrial(); | ||
|
||
EXPECT_EQ(0, net::GetSocketReusePolicy()); | ||
} | ||
|
||
TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Random) { | ||
scoped_ptr<MainFunctionParams> params( | ||
new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); | ||
scoped_ptr<BrowserMainParts> bw(BrowserMainParts::CreateBrowserMainParts( | ||
*params)); | ||
|
||
const int kNumRuns = 1000; | ||
for (int i = 0; i < kNumRuns; i++) { | ||
bw->WarmConnectionFieldTrial(); | ||
int val = net::GetSocketReusePolicy(); | ||
EXPECT_LE(val, 2); | ||
EXPECT_GE(val, 0); | ||
} | ||
} | ||
|
||
TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Invalid) { | ||
command_line_.AppendSwitchASCII(switches::kSocketReusePolicy, "100"); | ||
|
||
scoped_ptr<MainFunctionParams> params( | ||
new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); | ||
scoped_ptr<BrowserMainParts> bw(BrowserMainParts::CreateBrowserMainParts( | ||
*params)); | ||
|
||
EXPECT_DEBUG_DEATH(bw->WarmConnectionFieldTrial(), | ||
"Not a valid socket reuse policy group"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.