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

Side by Side Diff: chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc

Issue 10440119: Introduce a delegate to avoid hardcoding "chrome-extension" in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge to LKGR Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 private: 55 private:
56 // Not owned here. 56 // Not owned here.
57 net::URLRequestThrottlerManager* throttler_manager_; 57 net::URLRequestThrottlerManager* throttler_manager_;
58 scoped_ptr<TestURLRequestContext> context_; 58 scoped_ptr<TestURLRequestContext> context_;
59 }; 59 };
60 60
61 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { 61 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher {
62 public: 62 public:
63 explicit TestCloudPrintURLFetcher( 63 explicit TestCloudPrintURLFetcher(
64 base::MessageLoopProxy* io_message_loop_proxy) 64 base::MessageLoopProxy* io_message_loop_proxy)
65 : io_message_loop_proxy_(io_message_loop_proxy) { 65 : io_message_loop_proxy_(io_message_loop_proxy),
66 throttler_manager_(&throttler_delegate_){
66 } 67 }
67 68
68 virtual net::URLRequestContextGetter* GetRequestContextGetter() { 69 virtual net::URLRequestContextGetter* GetRequestContextGetter() {
69 return new TrackingTestURLRequestContextGetter( 70 return new TrackingTestURLRequestContextGetter(
70 io_message_loop_proxy_.get(), throttler_manager()); 71 io_message_loop_proxy_.get(), throttler_manager());
71 } 72 }
72 73
73 net::URLRequestThrottlerManager* throttler_manager() { 74 net::URLRequestThrottlerManager* throttler_manager() {
74 return &throttler_manager_; 75 return &throttler_manager_;
75 } 76 }
76 77
77 private: 78 private:
78 virtual ~TestCloudPrintURLFetcher() {} 79 virtual ~TestCloudPrintURLFetcher() {}
79 80
80 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 81 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
81 82
83 TestURLRequestThrottlerManagerDelegate throttler_delegate_;
84
82 // We set this as the throttler manager for the 85 // We set this as the throttler manager for the
83 // TestURLRequestContext we create. 86 // TestURLRequestContext we create.
84 net::URLRequestThrottlerManager throttler_manager_; 87 net::URLRequestThrottlerManager throttler_manager_;
85 }; 88 };
86 89
87 class CloudPrintURLFetcherTest : public testing::Test, 90 class CloudPrintURLFetcherTest : public testing::Test,
88 public CloudPrintURLFetcherDelegate { 91 public CloudPrintURLFetcherDelegate {
89 public: 92 public:
90 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { } 93 CloudPrintURLFetcherTest() : max_retries_(0), fetcher_(NULL) { }
91 94
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 FilePath(kDocRoot)); 372 FilePath(kDocRoot));
370 ASSERT_TRUE(test_server.Start()); 373 ASSERT_TRUE(test_server.Start());
371 374
372 GURL url(test_server.GetURL("defaultresponse")); 375 GURL url(test_server.GetURL("defaultresponse"));
373 CreateFetcher(url, 11); 376 CreateFetcher(url, 11);
374 377
375 MessageLoop::current()->Run(); 378 MessageLoop::current()->Run();
376 } 379 }
377 380
378 } // namespace. 381 } // namespace.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698