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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "components/navigation_interception/intercept_navigation_resource_throt
tle.h" | 10 #include "components/navigation_interception/intercept_navigation_resource_throt
tle.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 CANCELLED | 79 CANCELLED |
80 }; | 80 }; |
81 | 81 |
82 MockResourceController() | 82 MockResourceController() |
83 : status_(UNKNOWN) { | 83 : status_(UNKNOWN) { |
84 } | 84 } |
85 | 85 |
86 Status status() const { return status_; } | 86 Status status() const { return status_; } |
87 | 87 |
88 // ResourceController: | 88 // ResourceController: |
89 virtual void Cancel() OVERRIDE { | 89 virtual void Cancel() override { |
90 NOTREACHED(); | 90 NOTREACHED(); |
91 } | 91 } |
92 virtual void CancelAndIgnore() OVERRIDE { | 92 virtual void CancelAndIgnore() override { |
93 status_ = CANCELLED; | 93 status_ = CANCELLED; |
94 } | 94 } |
95 virtual void CancelWithError(int error_code) OVERRIDE { | 95 virtual void CancelWithError(int error_code) override { |
96 NOTREACHED(); | 96 NOTREACHED(); |
97 } | 97 } |
98 virtual void Resume() OVERRIDE { | 98 virtual void Resume() override { |
99 DCHECK(status_ == UNKNOWN); | 99 DCHECK(status_ == UNKNOWN); |
100 status_ = RESUMED; | 100 status_ = RESUMED; |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 Status status_; | 104 Status status_; |
105 }; | 105 }; |
106 | 106 |
107 // TestIOThreadState ---------------------------------------------------------- | 107 // TestIOThreadState ---------------------------------------------------------- |
108 | 108 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // InterceptNavigationResourceThrottleTest ------------------------------------ | 183 // InterceptNavigationResourceThrottleTest ------------------------------------ |
184 | 184 |
185 class InterceptNavigationResourceThrottleTest | 185 class InterceptNavigationResourceThrottleTest |
186 : public content::RenderViewHostTestHarness { | 186 : public content::RenderViewHostTestHarness { |
187 public: | 187 public: |
188 InterceptNavigationResourceThrottleTest() | 188 InterceptNavigationResourceThrottleTest() |
189 : mock_callback_receiver_(new MockInterceptCallbackReceiver()), | 189 : mock_callback_receiver_(new MockInterceptCallbackReceiver()), |
190 io_thread_state_(NULL) { | 190 io_thread_state_(NULL) { |
191 } | 191 } |
192 | 192 |
193 virtual void SetUp() OVERRIDE { | 193 virtual void SetUp() override { |
194 RenderViewHostTestHarness::SetUp(); | 194 RenderViewHostTestHarness::SetUp(); |
195 } | 195 } |
196 | 196 |
197 virtual void TearDown() OVERRIDE { | 197 virtual void TearDown() override { |
198 if (web_contents()) | 198 if (web_contents()) |
199 web_contents()->SetDelegate(NULL); | 199 web_contents()->SetDelegate(NULL); |
200 | 200 |
201 content::BrowserThread::DeleteSoon( | 201 content::BrowserThread::DeleteSoon( |
202 content::BrowserThread::IO, FROM_HERE, io_thread_state_); | 202 content::BrowserThread::IO, FROM_HERE, io_thread_state_); |
203 | 203 |
204 RenderViewHostTestHarness::TearDown(); | 204 RenderViewHostTestHarness::TearDown(); |
205 } | 205 } |
206 | 206 |
207 void SetIOThreadState(TestIOThreadState* io_thread_state) { | 207 void SetIOThreadState(TestIOThreadState* io_thread_state) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 REDIRECT_MODE_302, | 471 REDIRECT_MODE_302, |
472 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), | 472 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), |
473 web_contents()->GetMainFrame()->GetRoutingID(), | 473 web_contents()->GetMainFrame()->GetRoutingID(), |
474 base::Unretained(&defer))); | 474 base::Unretained(&defer))); |
475 | 475 |
476 // Wait for the request to finish processing. | 476 // Wait for the request to finish processing. |
477 base::RunLoop().RunUntilIdle(); | 477 base::RunLoop().RunUntilIdle(); |
478 } | 478 } |
479 | 479 |
480 } // namespace navigation_interception | 480 } // namespace navigation_interception |
OLD | NEW |