OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/navigation_interception/intercept_navigation_throttle.h" | 5 #include "components/navigation_interception/intercept_navigation_throttle.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 const char kTestUrl[] = "http://www.test.com/"; | 31 const char kTestUrl[] = "http://www.test.com/"; |
32 | 32 |
33 // The MS C++ compiler complains about not being able to resolve which url() | 33 // The MS C++ compiler complains about not being able to resolve which url() |
34 // method (const or non-const) to use if we use the Property matcher to check | 34 // method (const or non-const) to use if we use the Property matcher to check |
35 // the return value of the NavigationParams::url() method. | 35 // the return value of the NavigationParams::url() method. |
36 // It is possible to suppress the error by specifying the types directly but | 36 // It is possible to suppress the error by specifying the types directly but |
37 // that results in very ugly syntax, which is why these custom matchers are | 37 // that results in very ugly syntax, which is why these custom matchers are |
38 // used instead. | 38 // used instead. |
39 MATCHER(NavigationParamsUrlIsTest, "") { | 39 MATCHER(NavigationParamsUrlIsTest, "") { |
40 return arg.url() == GURL(kTestUrl); | 40 return arg.url() == kTestUrl; |
41 } | 41 } |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 // MockInterceptCallbackReceiver ---------------------------------------------- | 45 // MockInterceptCallbackReceiver ---------------------------------------------- |
46 | 46 |
47 class MockInterceptCallbackReceiver { | 47 class MockInterceptCallbackReceiver { |
48 public: | 48 public: |
49 MOCK_METHOD2(ShouldIgnoreNavigation, | 49 MOCK_METHOD2(ShouldIgnoreNavigation, |
50 bool(content::WebContents* source, | 50 bool(content::WebContents* source, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ShouldIgnoreNavigation( | 155 ShouldIgnoreNavigation( |
156 _, AllOf(NavigationParamsUrlIsTest(), | 156 _, AllOf(NavigationParamsUrlIsTest(), |
157 Property(&NavigationParams::is_post, Eq(false))))) | 157 Property(&NavigationParams::is_post, Eq(false))))) |
158 .WillOnce(Return(false)); | 158 .WillOnce(Return(false)); |
159 NavigationThrottle::ThrottleCheckResult result = Simulate302(); | 159 NavigationThrottle::ThrottleCheckResult result = Simulate302(); |
160 | 160 |
161 EXPECT_EQ(NavigationThrottle::PROCEED, result); | 161 EXPECT_EQ(NavigationThrottle::PROCEED, result); |
162 } | 162 } |
163 | 163 |
164 } // namespace navigation_interception | 164 } // namespace navigation_interception |
OLD | NEW |