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 "content/public/renderer/resource_fetcher.h" | 5 #include "content/public/renderer/resource_fetcher.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.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 | 85 |
86 timed_out_ = true; | 86 timed_out_ = true; |
87 if (!completed_) | 87 if (!completed_) |
88 quit_task_.Run(); | 88 quit_task_.Run(); |
89 FAIL() << "fetch timed out"; | 89 FAIL() << "fetch timed out"; |
90 } | 90 } |
91 | 91 |
92 static FetcherDelegate* instance_; | 92 static FetcherDelegate* instance_; |
93 | 93 |
94 private: | 94 private: |
95 base::OneShotTimer<FetcherDelegate> timer_; | 95 base::OneShotTimer timer_; |
96 bool completed_; | 96 bool completed_; |
97 bool timed_out_; | 97 bool timed_out_; |
98 WebURLResponse response_; | 98 WebURLResponse response_; |
99 std::string data_; | 99 std::string data_; |
100 base::Closure quit_task_; | 100 base::Closure quit_task_; |
101 }; | 101 }; |
102 | 102 |
103 FetcherDelegate* FetcherDelegate::instance_ = NULL; | 103 FetcherDelegate* FetcherDelegate::instance_ = NULL; |
104 | 104 |
105 class EvilFetcherDelegate : public FetcherDelegate { | 105 class EvilFetcherDelegate : public FetcherDelegate { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 ASSERT_TRUE(test_server()->Start()); | 381 ASSERT_TRUE(test_server()->Start()); |
382 GURL url(test_server()->GetURL("echoheader?header")); | 382 GURL url(test_server()->GetURL("echoheader?header")); |
383 | 383 |
384 PostTaskToInProcessRendererAndWait( | 384 PostTaskToInProcessRendererAndWait( |
385 base::Bind( | 385 base::Bind( |
386 &ResourceFetcherTests::ResourceFetcherSetHeader, | 386 &ResourceFetcherTests::ResourceFetcherSetHeader, |
387 base::Unretained(this), url)); | 387 base::Unretained(this), url)); |
388 } | 388 } |
389 | 389 |
390 } // namespace content | 390 } // namespace content |
OLD | NEW |