OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/subresource_filter/content/browser/content_subresource_filt
er_throttle_manager.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt
er_throttle_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // content::NavigationThrottle: | 67 // content::NavigationThrottle: |
68 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override { | 68 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override { |
69 return MaybeNotifyActivation(WILL_START_REQUEST); | 69 return MaybeNotifyActivation(WILL_START_REQUEST); |
70 } | 70 } |
71 | 71 |
72 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() | 72 content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() |
73 override { | 73 override { |
74 return MaybeNotifyActivation(WILL_PROCESS_RESPONSE); | 74 return MaybeNotifyActivation(WILL_PROCESS_RESPONSE); |
75 } | 75 } |
| 76 const char* GetNameForLogging() override { |
| 77 return "MockPageStateActivationThrottle"; |
| 78 } |
76 | 79 |
77 private: | 80 private: |
78 content::NavigationThrottle::ThrottleCheckResult MaybeNotifyActivation( | 81 content::NavigationThrottle::ThrottleCheckResult MaybeNotifyActivation( |
79 PageActivationNotificationTiming throttle_state) { | 82 PageActivationNotificationTiming throttle_state) { |
80 if (throttle_state == activation_throttle_state_) { | 83 if (throttle_state == activation_throttle_state_) { |
81 auto it = mock_page_activations_.find(navigation_handle()->GetURL()); | 84 auto it = mock_page_activations_.find(navigation_handle()->GetURL()); |
82 if (it != mock_page_activations_.end()) { | 85 if (it != mock_page_activations_.end()) { |
83 throttle_manager_->NotifyPageActivationComputed(navigation_handle(), | 86 throttle_manager_->NotifyPageActivationComputed(navigation_handle(), |
84 it->second); | 87 it->second); |
85 } | 88 } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 EXPECT_EQ(0, disallowed_notification_count()); | 694 EXPECT_EQ(0, disallowed_notification_count()); |
692 EXPECT_EQ(1, attempted_frame_activations()); | 695 EXPECT_EQ(1, attempted_frame_activations()); |
693 } | 696 } |
694 | 697 |
695 // TODO(csharrison): Make sure the following conditions are exercised in tests: | 698 // TODO(csharrison): Make sure the following conditions are exercised in tests: |
696 // | 699 // |
697 // - Synchronous navigations to about:blank. These hit issues with the | 700 // - Synchronous navigations to about:blank. These hit issues with the |
698 // NavigationSimulator currently. | 701 // NavigationSimulator currently. |
699 | 702 |
700 } // namespace subresource_filter | 703 } // namespace subresource_filter |
OLD | NEW |