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

Side by Side Diff: chrome/browser/extensions/extension_protocols_unittest.cc

Issue 10836248: Turned job_factory into a pure virtual class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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 <string> 5 #include <string>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/extensions/extension_info_map.h" 9 #include "chrome/browser/extensions/extension_info_map.h"
10 #include "chrome/browser/extensions/extension_protocols.h" 10 #include "chrome/browser/extensions/extension_protocols.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/public/browser/resource_request_info.h" 12 #include "content/public/browser/resource_request_info.h"
13 #include "content/public/test/mock_resource_context.h" 13 #include "content/public/test/mock_resource_context.h"
14 #include "content/public/test/test_browser_thread.h" 14 #include "content/public/test/test_browser_thread.h"
15 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
16 #include "net/url_request/url_request_job_factory_impl.h"
16 #include "net/url_request/url_request_status.h" 17 #include "net/url_request/url_request_status.h"
17 #include "net/url_request/url_request_test_util.h" 18 #include "net/url_request/url_request_test_util.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 using content::BrowserThread; 21 using content::BrowserThread;
21 using extensions::Extension; 22 using extensions::Extension;
22 23
23 namespace { 24 namespace {
24 25
25 scoped_refptr<Extension> CreateTestExtension(const std::string& name, 26 scoped_refptr<Extension> CreateTestExtension(const std::string& name,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 request->Start(); 76 request->Start();
76 MessageLoop::current()->Run(); 77 MessageLoop::current()->Run();
77 } 78 }
78 79
79 protected: 80 protected:
80 MessageLoopForIO message_loop_; 81 MessageLoopForIO message_loop_;
81 content::TestBrowserThread ui_thread_; 82 content::TestBrowserThread ui_thread_;
82 content::TestBrowserThread file_thread_; 83 content::TestBrowserThread file_thread_;
83 content::TestBrowserThread io_thread_; 84 content::TestBrowserThread io_thread_;
84 scoped_refptr<ExtensionInfoMap> extension_info_map_; 85 scoped_refptr<ExtensionInfoMap> extension_info_map_;
85 net::URLRequestJobFactory job_factory_; 86 net::URLRequestJobFactoryImpl job_factory_;
86 const net::URLRequestJobFactory* old_factory_; 87 const net::URLRequestJobFactory* old_factory_;
87 TestDelegate test_delegate_; 88 TestDelegate test_delegate_;
88 content::MockResourceContext resource_context_; 89 content::MockResourceContext resource_context_;
89 }; 90 };
90 91
91 // Tests that making a chrome-extension request in an incognito context is 92 // Tests that making a chrome-extension request in an incognito context is
92 // only allowed under the right circumstances (if the extension is allowed 93 // only allowed under the right circumstances (if the extension is allowed
93 // in incognito, and it's either a non-main-frame request or a split-mode 94 // in incognito, and it's either a non-main-frame request or a split-mode
94 // extension). 95 // extension).
95 TEST_F(ExtensionProtocolTest, IncognitoRequest) { 96 TEST_F(ExtensionProtocolTest, IncognitoRequest) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 cases[i].name; 149 cases[i].name;
149 } else { 150 } else {
150 EXPECT_EQ(net::ERR_ADDRESS_UNREACHABLE, request.status().error()) << 151 EXPECT_EQ(net::ERR_ADDRESS_UNREACHABLE, request.status().error()) <<
151 cases[i].name; 152 cases[i].name;
152 } 153 }
153 } 154 }
154 } 155 }
155 } 156 }
156 157
157 } // namespace 158 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698