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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 #include "content/public/browser/navigation_entry.h" | 8 #include "content/public/browser/navigation_entry.h" |
9 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 9 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
10 #include "content/public/browser/resource_throttle.h" | 10 #include "content/public/browser/resource_throttle.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // request is destroyed, and then inspecting whether it completed successfully. | 29 // request is destroyed, and then inspecting whether it completed successfully. |
30 class TrackingResourceDispatcherHostDelegate | 30 class TrackingResourceDispatcherHostDelegate |
31 : public ShellResourceDispatcherHostDelegate { | 31 : public ShellResourceDispatcherHostDelegate { |
32 public: | 32 public: |
33 TrackingResourceDispatcherHostDelegate() : throttle_created_(false) { | 33 TrackingResourceDispatcherHostDelegate() : throttle_created_(false) { |
34 } | 34 } |
35 | 35 |
36 virtual void RequestBeginning( | 36 virtual void RequestBeginning( |
37 net::URLRequest* request, | 37 net::URLRequest* request, |
38 ResourceContext* resource_context, | 38 ResourceContext* resource_context, |
39 appcache::AppCacheService* appcache_service, | 39 AppCacheService* appcache_service, |
40 ResourceType::Type resource_type, | 40 ResourceType::Type resource_type, |
41 int child_id, | 41 int child_id, |
42 int route_id, | 42 int route_id, |
43 ScopedVector<ResourceThrottle>* throttles) OVERRIDE { | 43 ScopedVector<ResourceThrottle>* throttles) OVERRIDE { |
44 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 44 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
45 ShellResourceDispatcherHostDelegate::RequestBeginning( | 45 ShellResourceDispatcherHostDelegate::RequestBeginning( |
46 request, resource_context, appcache_service, resource_type, child_id, | 46 request, resource_context, appcache_service, resource_type, child_id, |
47 route_id, throttles); | 47 route_id, throttles); |
48 // Expect only a single request for the tracked url. | 48 // Expect only a single request for the tracked url. |
49 ASSERT_FALSE(throttle_created_); | 49 ASSERT_FALSE(throttle_created_); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 457 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
458 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); | 458 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL()); |
459 | 459 |
460 // Make sure the request for url2 did not complete. | 460 // Make sure the request for url2 did not complete. |
461 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); | 461 EXPECT_FALSE(tracking_delegate().WaitForTrackedURLAndGetCompleted()); |
462 | 462 |
463 shell()->web_contents()->SetDelegate(old_delegate); | 463 shell()->web_contents()->SetDelegate(old_delegate); |
464 } | 464 } |
465 | 465 |
466 } // namespace content | 466 } // namespace content |
OLD | NEW |