OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
mmenke
2016/04/08 15:19:13
new files shouldn't use the (c)
clamy
2016/04/08 16:03:17
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ | |
6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/run_loop.h" | |
mmenke
2016/04/08 15:19:13
Forward declare this, and move the include into th
clamy
2016/04/08 16:03:18
Done.
| |
11 #include "base/time/time.h" | |
12 #include "content/browser/loader/navigation_url_loader_delegate.h" | |
13 #include "net/url_request/redirect_info.h" | |
14 | |
15 namespace content { | |
16 | |
17 class StreamHandle; | |
18 struct ResourceResponse; | |
19 // PlzNavigate | |
mmenke
2016/04/08 15:19:12
nit: Add blank line before comment.
clamy
2016/04/08 16:03:18
Done.
| |
20 // Test implementation of NavigationURLLoaderDelegate to monitor navigation | |
21 // progress in the network stack. | |
22 class TestNavigationURLLoaderDelegate : public NavigationURLLoaderDelegate { | |
23 public: | |
24 TestNavigationURLLoaderDelegate(); | |
25 ~TestNavigationURLLoaderDelegate() override; | |
26 | |
27 const net::RedirectInfo& redirect_info() const { return redirect_info_; } | |
28 ResourceResponse* redirect_response() const { | |
29 return redirect_response_.get(); | |
30 } | |
31 ResourceResponse* response() const { return response_.get(); } | |
32 StreamHandle* body() const { return body_.get(); } | |
33 int net_error() const { return net_error_; } | |
34 int on_request_handled_counter() const { return on_request_handled_counter_; } | |
35 | |
36 // Waits for various navigation events. | |
mmenke
2016/04/08 15:19:13
Think it's important to note that the event we're
clamy
2016/04/08 16:03:17
Done.
| |
37 void WaitForRequestRedirected(); | |
38 void WaitForResponseStarted(); | |
39 void WaitForRequestFailed(); | |
40 void WaitForRequestStarted(); | |
41 | |
42 void ReleaseBody(); | |
43 | |
44 // NavigationURLLoaderDelegate implementation. | |
45 void OnRequestRedirected( | |
46 const net::RedirectInfo& redirect_info, | |
47 const scoped_refptr<ResourceResponse>& response) override; | |
48 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, | |
49 scoped_ptr<StreamHandle> body) override; | |
50 void OnRequestFailed(bool in_cache, int net_error) override; | |
51 void OnRequestStarted(base::TimeTicks timestamp) override; | |
52 | |
53 private: | |
54 net::RedirectInfo redirect_info_; | |
55 scoped_refptr<ResourceResponse> redirect_response_; | |
56 scoped_refptr<ResourceResponse> response_; | |
57 scoped_ptr<StreamHandle> body_; | |
mmenke
2016/04/08 15:19:13
"Streams" make me sad. None of the classes in con
clamy
2016/04/08 16:03:18
Acknowledged.
| |
58 int net_error_; | |
59 int on_request_handled_counter_; | |
60 | |
61 scoped_ptr<base::RunLoop> request_redirected_; | |
62 scoped_ptr<base::RunLoop> response_started_; | |
63 scoped_ptr<base::RunLoop> request_failed_; | |
64 scoped_ptr<base::RunLoop> request_started_; | |
mmenke
2016/04/08 15:19:13
DISALLOW_COPY_AND_ASSIGN, include base/macros.h
clamy
2016/04/08 16:03:18
Done.
| |
65 }; | |
66 | |
67 } // namespace content | |
68 | |
69 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H | |
OLD | NEW |