OLD | NEW |
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 #include "chrome/browser/component_updater/component_updater_interceptor.h" | 4 #include "chrome/browser/component_updater/component_updater_interceptor.h" |
5 | 5 |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/threading/thread_restrictions.h" | 7 #include "base/threading/thread_restrictions.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "net/url_request/url_request_test_job.h" | 9 #include "net/url_request/url_request_test_job.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
| 12 using content::BrowserThread; |
| 13 |
12 ComponentUpdateInterceptor::ComponentUpdateInterceptor() | 14 ComponentUpdateInterceptor::ComponentUpdateInterceptor() |
13 : hit_count_(0) { | 15 : hit_count_(0) { |
14 net::URLRequest::Deprecated::RegisterRequestInterceptor(this); | 16 net::URLRequest::Deprecated::RegisterRequestInterceptor(this); |
15 } | 17 } |
16 | 18 |
17 ComponentUpdateInterceptor::~ComponentUpdateInterceptor() { | 19 ComponentUpdateInterceptor::~ComponentUpdateInterceptor() { |
18 net::URLRequest::Deprecated::UnregisterRequestInterceptor(this); | 20 net::URLRequest::Deprecated::UnregisterRequestInterceptor(this); |
19 } | 21 } |
20 | 22 |
21 net::URLRequestJob* ComponentUpdateInterceptor::MaybeIntercept( | 23 net::URLRequestJob* ComponentUpdateInterceptor::MaybeIntercept( |
(...skipping 30 matching lines...) Expand all Loading... |
52 // It's ok to do a blocking disk access on this thread; this class | 54 // It's ok to do a blocking disk access on this thread; this class |
53 // is just used for tests. | 55 // is just used for tests. |
54 base::ThreadRestrictions::ScopedAllowIO allow_io; | 56 base::ThreadRestrictions::ScopedAllowIO allow_io; |
55 GURL gurl(url); | 57 GURL gurl(url); |
56 EXPECT_EQ("http", gurl.scheme()); | 58 EXPECT_EQ("http", gurl.scheme()); |
57 EXPECT_EQ("localhost", gurl.host()); | 59 EXPECT_EQ("localhost", gurl.host()); |
58 EXPECT_TRUE(file_util::PathExists(path)); | 60 EXPECT_TRUE(file_util::PathExists(path)); |
59 Response response = { path, headers }; | 61 Response response = { path, headers }; |
60 responses_[gurl] = response; | 62 responses_[gurl] = response; |
61 } | 63 } |
OLD | NEW |