summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-21 05:37:47 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-21 05:37:47 +0000
commit2bbce91ab3605090c2dd0cdd61fb60c77faf31db (patch)
tree22f96caac5eab87f6eb62d90d8e6291f331bb6e4
parentf615bda33ed9381b6bb3b0218c6ab5f0393664be (diff)
downloadchromium_src-2bbce91ab3605090c2dd0cdd61fb60c77faf31db.zip
chromium_src-2bbce91ab3605090c2dd0cdd61fb60c77faf31db.tar.gz
chromium_src-2bbce91ab3605090c2dd0cdd61fb60c77faf31db.tar.bz2
Fix PrerenderInterceptor leaks.
BUG=none TEST=none Review URL: http://codereview.chromium.org/5109012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66911 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/prerender_interceptor_unittest.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/net/prerender_interceptor_unittest.cc b/chrome/browser/net/prerender_interceptor_unittest.cc
index 9c2200b..55e5a31 100644
--- a/chrome/browser/net/prerender_interceptor_unittest.cc
+++ b/chrome/browser/net/prerender_interceptor_unittest.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/callback.h"
+#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/message_loop_proxy.h"
#include "base/scoped_ptr.h"
@@ -15,11 +16,12 @@
#include "net/base/load_flags.h"
#include "net/test/test_server.h"
#include "net/url_request/url_request_unittest.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace chrome_browser_net {
class PrerenderInterceptorTest : public testing::Test {
- public:
+ protected:
PrerenderInterceptorTest();
void MakeTestUrl(const std::string& base);
@@ -29,6 +31,7 @@ class PrerenderInterceptorTest : public testing::Test {
GURL gurl_;
GURL last_intercepted_gurl_;
scoped_ptr<URLRequest> req_;
+
private:
void SetLastInterceptedGurl(const GURL& url);
@@ -36,6 +39,7 @@ class PrerenderInterceptorTest : public testing::Test {
MessageLoopForIO io_loop_;
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
BrowserThread ui_thread_;
+ TestDelegate delegate_;
};
PrerenderInterceptorTest::PrerenderInterceptorTest()
@@ -59,13 +63,15 @@ void PrerenderInterceptorTest::SetUp() {
void PrerenderInterceptorTest::MakeTestUrl(const std::string& base) {
gurl_ = test_server_.GetURL(base);
- req_.reset(new TestURLRequest(gurl_, new TestDelegate()));
+ req_.reset(new TestURLRequest(gurl_, &delegate_));
}
void PrerenderInterceptorTest::SetLastInterceptedGurl(const GURL& url) {
last_intercepted_gurl_ = url;
}
+namespace {
+
TEST_F(PrerenderInterceptorTest, Interception) {
MakeTestUrl("files/prerender/doc1.html");
req_->set_load_flags(req_->load_flags() | net::LOAD_PREFETCH);
@@ -96,5 +102,6 @@ TEST_F(PrerenderInterceptorTest, WrongMimeType) {
EXPECT_NE(gurl_, last_intercepted_gurl_);
}
-} // namespace chrome_browser_net
+} // namespace
+} // namespace chrome_browser_net