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

Side by Side Diff: chrome/browser/sync/glue/http_bridge_unittest.cc

Issue 6248021: Reapply r72562 with willchan's nits + locally tested shlib fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix path Created 9 years, 11 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 | « chrome/browser/printing/print_dialog_cloud_uitest.cc ('k') | chrome/browser/unload_uitest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop_proxy.h" 5 #include "base/message_loop_proxy.h"
6 #include "base/threading/thread.h" 6 #include "base/threading/thread.h"
7 #include "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/browser/sync/glue/http_bridge.h" 8 #include "chrome/browser/sync/glue/http_bridge.h"
9 #include "chrome/common/net/test_url_fetcher_factory.h" 9 #include "chrome/common/net/test_url_fetcher_factory.h"
10 #include "net/url_request/url_request_unittest.h" 10 #include "chrome/test/test_url_request_context_getter.h"
11 #include "net/url_request/url_request_test_util.h"
11 #include "net/test/test_server.h" 12 #include "net/test/test_server.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 using browser_sync::HttpBridge; 15 using browser_sync::HttpBridge;
15 16
16 namespace { 17 namespace {
17 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. 18 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113.
18 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); 19 const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data");
19 } 20 }
20 21
21 // Lazy getter for TestURLRequestContext instances.
22 class TestURLRequestContextGetter : public URLRequestContextGetter {
23 public:
24 virtual net::URLRequestContext* GetURLRequestContext() {
25 if (!context_)
26 context_ = new TestURLRequestContext;
27 return context_;
28 }
29 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
30 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
31 }
32
33 private:
34 ~TestURLRequestContextGetter() {}
35
36 scoped_refptr<net::URLRequestContext> context_;
37 };
38
39 class HttpBridgeTest : public testing::Test { 22 class HttpBridgeTest : public testing::Test {
40 public: 23 public:
41 HttpBridgeTest() 24 HttpBridgeTest()
42 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)), 25 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)),
43 fake_default_request_context_getter_(NULL), 26 fake_default_request_context_getter_(NULL),
44 io_thread_(BrowserThread::IO) { 27 io_thread_(BrowserThread::IO) {
45 } 28 }
46 29
47 virtual void SetUp() { 30 virtual void SetUp() {
48 base::Thread::Options options; 31 base::Thread::Options options;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int os_error = 0; 254 int os_error = 0;
272 int response_code = 0; 255 int response_code = 0;
273 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); 256 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code);
274 EXPECT_TRUE(success); 257 EXPECT_TRUE(success);
275 EXPECT_EQ(200, response_code); 258 EXPECT_EQ(200, response_code);
276 EXPECT_EQ(0, os_error); 259 EXPECT_EQ(0, os_error);
277 260
278 EXPECT_EQ(http_bridge->GetResponseHeaderValue("Content-type"), "text/html"); 261 EXPECT_EQ(http_bridge->GetResponseHeaderValue("Content-type"), "text/html");
279 EXPECT_TRUE(http_bridge->GetResponseHeaderValue("invalid-header").empty()); 262 EXPECT_TRUE(http_bridge->GetResponseHeaderValue("invalid-header").empty());
280 } 263 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_dialog_cloud_uitest.cc ('k') | chrome/browser/unload_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698