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

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

Issue 1837003: Created a stock implementation of the MessageLoopProxy interface than can be ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Rearranged header files Created 10 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 | « chrome/browser/sync/glue/http_bridge.cc ('k') | chrome/test/testing_profile.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/thread.h" 6 #include "base/thread.h"
7 #include "chrome/browser/chrome_thread.h" 7 #include "chrome/browser/chrome_thread.h"
8 #include "chrome/browser/net/test_url_fetcher_factory.h" 8 #include "chrome/browser/net/test_url_fetcher_factory.h"
9 #include "chrome/browser/sync/glue/http_bridge.h" 9 #include "chrome/browser/sync/glue/http_bridge.h"
10 #include "net/url_request/url_request_unittest.h" 10 #include "net/url_request/url_request_unittest.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using browser_sync::HttpBridge; 13 using browser_sync::HttpBridge;
14 14
15 namespace { 15 namespace {
16 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. 16 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113.
17 const wchar_t kDocRoot[] = L"chrome/test/data"; 17 const wchar_t kDocRoot[] = L"chrome/test/data";
18 } 18 }
19 19
20 // Lazy getter for TestURLRequestContext instances. 20 // Lazy getter for TestURLRequestContext instances.
21 class TestURLRequestContextGetter : public URLRequestContextGetter { 21 class TestURLRequestContextGetter : public URLRequestContextGetter {
22 public: 22 public:
23 virtual URLRequestContext* GetURLRequestContext() { 23 virtual URLRequestContext* GetURLRequestContext() {
24 if (!context_) 24 if (!context_)
25 context_ = new TestURLRequestContext; 25 context_ = new TestURLRequestContext;
26 return context_; 26 return context_;
27 } 27 }
28 virtual scoped_refptr<MessageLoopProxy> GetIOMessageLoopProxy() { 28 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
29 return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO); 29 return ChromeThread::GetMessageLoopProxyForThread(ChromeThread::IO);
30 } 30 }
31 31
32 private: 32 private:
33 ~TestURLRequestContextGetter() {} 33 ~TestURLRequestContextGetter() {}
34 34
35 scoped_refptr<URLRequestContext> context_; 35 scoped_refptr<URLRequestContext> context_;
36 }; 36 };
37 37
38 class HttpBridgeTest : public testing::Test { 38 class HttpBridgeTest : public testing::Test {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int os_error = 0; 271 int os_error = 0;
272 int response_code = 0; 272 int response_code = 0;
273 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); 273 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code);
274 EXPECT_TRUE(success); 274 EXPECT_TRUE(success);
275 EXPECT_EQ(200, response_code); 275 EXPECT_EQ(200, response_code);
276 EXPECT_EQ(0, os_error); 276 EXPECT_EQ(0, os_error);
277 277
278 EXPECT_EQ(http_bridge->GetResponseHeaderValue("Content-type"), "text/html"); 278 EXPECT_EQ(http_bridge->GetResponseHeaderValue("Content-type"), "text/html");
279 EXPECT_TRUE(http_bridge->GetResponseHeaderValue("invalid-header").empty()); 279 EXPECT_TRUE(http_bridge->GetResponseHeaderValue("invalid-header").empty());
280 } 280 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/http_bridge.cc ('k') | chrome/test/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698