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

Side by Side Diff: remoting/host/url_fetcher_unittest.cc

Issue 10173009: Always create URLRequestContextGetter in ChromotingHostContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « remoting/host/chromoting_host_context.cc ('k') | remoting/host/url_request_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "remoting/host/url_fetcher.h" 5 #include "remoting/host/url_fetcher.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "net/test/test_server.h" 9 #include "net/test/test_server.h"
10 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
(...skipping 13 matching lines...) Expand all
24 io_thread_("TestIOThread"), 24 io_thread_("TestIOThread"),
25 file_thread_("TestFileThread") { 25 file_thread_("TestFileThread") {
26 } 26 }
27 27
28 protected: 28 protected:
29 void SetUp() OVERRIDE { 29 void SetUp() OVERRIDE {
30 ASSERT_TRUE(io_thread_.StartWithOptions( 30 ASSERT_TRUE(io_thread_.StartWithOptions(
31 base::Thread::Options(MessageLoop::TYPE_IO, 0))); 31 base::Thread::Options(MessageLoop::TYPE_IO, 0)));
32 ASSERT_TRUE(file_thread_.StartWithOptions( 32 ASSERT_TRUE(file_thread_.StartWithOptions(
33 base::Thread::Options(MessageLoop::TYPE_IO, 0))); 33 base::Thread::Options(MessageLoop::TYPE_IO, 0)));
34 context_getter_ = new URLRequestContextGetter(io_thread_.message_loop(), 34 context_getter_ = new URLRequestContextGetter(
35 file_thread_.message_loop()); 35 message_loop_.message_loop_proxy(),
36 io_thread_.message_loop(),
37 static_cast<MessageLoopForIO*>(file_thread_.message_loop()));
36 ASSERT_TRUE(test_server_.Start()); 38 ASSERT_TRUE(test_server_.Start());
37 } 39 }
38 40
39 protected: 41 protected:
40 void OnDone(const net::URLRequestStatus& status, 42 void OnDone(const net::URLRequestStatus& status,
41 int response_code, 43 int response_code,
42 const std::string& response) { 44 const std::string& response) {
43 ASSERT_EQ(MessageLoop::current(), &message_loop_); 45 ASSERT_EQ(MessageLoop::current(), &message_loop_);
44 status_ = status; 46 status_ = status;
45 response_code_ = response_code; 47 response_code_ = response_code;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 UrlFetcher fetcher(test_server_.GetURL("auth-basic"), UrlFetcher::GET); 87 UrlFetcher fetcher(test_server_.GetURL("auth-basic"), UrlFetcher::GET);
86 fetcher.SetRequestContext(context_getter_); 88 fetcher.SetRequestContext(context_getter_);
87 fetcher.Start(base::Bind(&UrlFetcherTest_TestFailed_Test::OnDone, 89 fetcher.Start(base::Bind(&UrlFetcherTest_TestFailed_Test::OnDone,
88 base::Unretained(this))); 90 base::Unretained(this)));
89 message_loop_.Run(); 91 message_loop_.Run();
90 EXPECT_EQ(net::URLRequestStatus::SUCCESS, status_.status()); 92 EXPECT_EQ(net::URLRequestStatus::SUCCESS, status_.status());
91 EXPECT_EQ(401, response_code_); 93 EXPECT_EQ(401, response_code_);
92 } 94 }
93 95
94 } // namespace remoting 96 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host_context.cc ('k') | remoting/host/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698