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

Side by Side Diff: net/proxy/proxy_script_fetcher_impl_unittest.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Call AllocateSystemIOPorts before PowerMonitor's ctor Created 8 years, 2 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
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 "net/proxy/proxy_script_fetcher_impl.h" 5 #include "net/proxy/proxy_script_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/http/http_network_session.h" 21 #include "net/http/http_network_session.h"
22 #include "net/http/http_server_properties_impl.h" 22 #include "net/http/http_server_properties_impl.h"
23 #include "net/test/test_server.h" 23 #include "net/test/test_server.h"
24 #include "net/url_request/url_request_context_storage.h" 24 #include "net/url_request/url_request_context_storage.h"
25 #include "net/url_request/url_request_file_job.h" 25 #include "net/url_request/url_request_file_job.h"
26 #include "net/url_request/url_request_job_factory_impl.h" 26 #include "net/url_request/url_request_job_factory_impl.h"
27 #include "net/url_request/url_request_test_util.h" 27 #include "net/url_request/url_request_test_util.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "testing/platform_test.h" 29 #include "testing/platform_test.h"
30 30
31 #if defined(OS_MACOSX)
32 #include "base/power_monitor/power_monitor.h"
33 #endif
34
31 namespace net { 35 namespace net {
32 36
33 // TODO(eroman): 37 // TODO(eroman):
34 // - Test canceling an outstanding request. 38 // - Test canceling an outstanding request.
35 // - Test deleting ProxyScriptFetcher while a request is in progress. 39 // - Test deleting ProxyScriptFetcher while a request is in progress.
36 40
37 namespace { 41 namespace {
38 42
39 const FilePath::CharType kDocRoot[] = 43 const FilePath::CharType kDocRoot[] =
40 FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"); 44 FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest");
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 }; 207 };
204 208
205 } // namespace 209 } // namespace
206 210
207 class ProxyScriptFetcherImplTest : public PlatformTest { 211 class ProxyScriptFetcherImplTest : public PlatformTest {
208 public: 212 public:
209 ProxyScriptFetcherImplTest() 213 ProxyScriptFetcherImplTest()
210 : test_server_(TestServer::TYPE_HTTP, 214 : test_server_(TestServer::TYPE_HTTP,
211 net::TestServer::kLocalhost, 215 net::TestServer::kLocalhost,
212 FilePath(kDocRoot)) { 216 FilePath(kDocRoot)) {
217 #if defined(OS_MACOSX)
218 // Must be called before PowerMonitor's ctor.
219 base::PowerMonitor::AllocateSystemIOPorts();
Hongbo Min 2012/10/16 14:14:40 ProxyScriptFetcherImplTest indirectly has a depend
220 #endif
213 context_.set_network_delegate(&network_delegate_); 221 context_.set_network_delegate(&network_delegate_);
214 } 222 }
215 223
216 protected: 224 protected:
217 TestServer test_server_; 225 TestServer test_server_;
218 BasicNetworkDelegate network_delegate_; 226 BasicNetworkDelegate network_delegate_;
219 RequestContext context_; 227 RequestContext context_;
220 }; 228 };
221 229
222 TEST_F(ProxyScriptFetcherImplTest, FileUrl) { 230 TEST_F(ProxyScriptFetcherImplTest, FileUrl) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 { 496 {
489 GURL url(kEncodedUrlBroken); 497 GURL url(kEncodedUrlBroken);
490 string16 text; 498 string16 text;
491 TestCompletionCallback callback; 499 TestCompletionCallback callback;
492 int result = pac_fetcher.Fetch(url, &text, callback.callback()); 500 int result = pac_fetcher.Fetch(url, &text, callback.callback());
493 EXPECT_EQ(ERR_FAILED, result); 501 EXPECT_EQ(ERR_FAILED, result);
494 } 502 }
495 } 503 }
496 504
497 } // namespace net 505 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698