| OLD | NEW |
| 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 "chrome/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 namespace { | 85 namespace { |
| 86 | 86 |
| 87 // Task used to make sure history has finished processing a request. Intended | 87 // Task used to make sure history has finished processing a request. Intended |
| 88 // for use with BlockUntilHistoryProcessesPendingRequests. | 88 // for use with BlockUntilHistoryProcessesPendingRequests. |
| 89 | 89 |
| 90 class QuittingHistoryDBTask : public HistoryDBTask { | 90 class QuittingHistoryDBTask : public HistoryDBTask { |
| 91 public: | 91 public: |
| 92 QuittingHistoryDBTask() {} | 92 QuittingHistoryDBTask() {} |
| 93 | 93 |
| 94 virtual bool RunOnDBThread(history::HistoryBackend* backend, | 94 virtual bool RunOnDBThread(history::HistoryBackend* backend, |
| 95 history::HistoryDatabase* db) { | 95 history::HistoryDatabase* db) OVERRIDE { |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 virtual void DoneRunOnMainThread() { | 99 virtual void DoneRunOnMainThread() OVERRIDE { |
| 100 MessageLoop::current()->Quit(); | 100 MessageLoop::current()->Quit(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 ~QuittingHistoryDBTask() {} | 104 virtual ~QuittingHistoryDBTask() {} |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(QuittingHistoryDBTask); | 106 DISALLOW_COPY_AND_ASSIGN(QuittingHistoryDBTask); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class TestExtensionURLRequestContext : public net::URLRequestContext { | 109 class TestExtensionURLRequestContext : public net::URLRequestContext { |
| 110 public: | 110 public: |
| 111 TestExtensionURLRequestContext() { | 111 TestExtensionURLRequestContext() { |
| 112 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); | 112 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); |
| 113 const char* schemes[] = {extensions::kExtensionScheme}; | 113 const char* schemes[] = {extensions::kExtensionScheme}; |
| 114 cookie_monster->SetCookieableSchemes(schemes, 1); | 114 cookie_monster->SetCookieableSchemes(schemes, 1); |
| 115 set_cookie_store(cookie_monster); | 115 set_cookie_store(cookie_monster); |
| 116 } | 116 } |
| 117 | 117 |
| 118 virtual ~TestExtensionURLRequestContext() {} | 118 virtual ~TestExtensionURLRequestContext() {} |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 class TestExtensionURLRequestContextGetter | 121 class TestExtensionURLRequestContextGetter |
| 122 : public net::URLRequestContextGetter { | 122 : public net::URLRequestContextGetter { |
| 123 public: | 123 public: |
| 124 virtual net::URLRequestContext* GetURLRequestContext() { | 124 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE { |
| 125 if (!context_.get()) | 125 if (!context_.get()) |
| 126 context_.reset(new TestExtensionURLRequestContext()); | 126 context_.reset(new TestExtensionURLRequestContext()); |
| 127 return context_.get(); | 127 return context_.get(); |
| 128 } | 128 } |
| 129 virtual scoped_refptr<base::SingleThreadTaskRunner> | 129 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 130 GetNetworkTaskRunner() const OVERRIDE { | 130 GetNetworkTaskRunner() const OVERRIDE { |
| 131 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 131 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 132 } | 132 } |
| 133 | 133 |
| 134 protected: | 134 protected: |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 794 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 795 DCHECK(!build_called_); | 795 DCHECK(!build_called_); |
| 796 build_called_ = true; | 796 build_called_ = true; |
| 797 return scoped_ptr<TestingProfile>(new TestingProfile( | 797 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 798 path_, | 798 path_, |
| 799 delegate_, | 799 delegate_, |
| 800 extension_policy_, | 800 extension_policy_, |
| 801 pref_service_.Pass(), | 801 pref_service_.Pass(), |
| 802 off_the_record_)); | 802 off_the_record_)); |
| 803 } | 803 } |
| OLD | NEW |