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

Unified Diff: chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new tests Created 6 years, 4 months 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: chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
index 69a46e73de01187db165499b21f35256cc9c6426..f4134d1d08d537d42556c614a0c734ed38a5439a 100644
--- a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
+++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc
@@ -21,6 +21,7 @@
#include "net/test/cert_test_util.h"
#include "net/url_request/fraudulent_certificate_reporter.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -115,23 +116,6 @@ class NotSendingTestReporter : public TestReporter {
}
};
-// For the first version of the feature, sending reports is "fire and forget".
-// Therefore, we test only that the Reporter tried to send a request at all.
-// In the future, when we have more sophisticated (i.e., any) error handling
-// and re-tries, we will need more sopisticated tests as well.
-//
-// This class doesn't do anything now, but in near future versions it will.
-class MockURLRequest : public net::URLRequest {
- public:
- explicit MockURLRequest(net::URLRequestContext* context)
- : net::URLRequest(GURL(std::string()),
- net::DEFAULT_PRIORITY,
- NULL,
- context) {}
-
- private:
-};
-
// A ChromeFraudulentCertificateReporter that uses a MockURLRequest, but is
// otherwise normal: reports are constructed and sent in the usual way.
class MockReporter : public ChromeFraudulentCertificateReporter {
@@ -141,7 +125,10 @@ class MockReporter : public ChromeFraudulentCertificateReporter {
virtual scoped_ptr<net::URLRequest> CreateURLRequest(
net::URLRequestContext* context) OVERRIDE {
- return scoped_ptr<net::URLRequest>(new MockURLRequest(context));
+ return context->CreateRequest(GURL(std::string()),
+ net::DEFAULT_PRIORITY,
+ NULL,
+ NULL);
}
virtual void SendReport(

Powered by Google App Engine
This is Rietveld 408576698