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 "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit
ion_attribute.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit
ion_attribute.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta
nts.h" | 9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta
nts.h" |
10 #include "content/public/browser/resource_request_info.h" | 10 #include "content/public/browser/resource_request_info.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 std::string error; | 60 std::string error; |
61 ListValue resource_types; | 61 ListValue resource_types; |
62 resource_types.Append(Value::CreateStringValue("main_frame")); | 62 resource_types.Append(Value::CreateStringValue("main_frame")); |
63 | 63 |
64 scoped_ptr<WebRequestConditionAttribute> attribute = | 64 scoped_ptr<WebRequestConditionAttribute> attribute = |
65 WebRequestConditionAttribute::Create( | 65 WebRequestConditionAttribute::Create( |
66 keys::kResourceTypeKey, &resource_types, &error); | 66 keys::kResourceTypeKey, &resource_types, &error); |
67 EXPECT_EQ("", error); | 67 EXPECT_EQ("", error); |
68 ASSERT_TRUE(attribute.get()); | 68 ASSERT_TRUE(attribute.get()); |
69 | 69 |
70 TestURLRequest url_request_ok(GURL("http://www.example.com"), NULL); | 70 TestURLRequestContext context; |
| 71 TestURLRequest url_request_ok(GURL("http://www.example.com"), NULL, &context); |
71 content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, | 72 content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, |
72 ResourceType::MAIN_FRAME, NULL, -1, -1); | 73 ResourceType::MAIN_FRAME, NULL, -1, -1); |
73 EXPECT_TRUE(attribute->IsFulfilled(&url_request_ok, ON_BEFORE_REQUEST)); | 74 EXPECT_TRUE(attribute->IsFulfilled(&url_request_ok, ON_BEFORE_REQUEST)); |
74 | 75 |
75 TestURLRequest url_request_fail(GURL("http://www.example.com"), NULL); | 76 TestURLRequest url_request_fail( |
| 77 GURL("http://www.example.com"), NULL, &context); |
76 content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, | 78 content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, |
77 ResourceType::SUB_FRAME, NULL, -1, -1); | 79 ResourceType::SUB_FRAME, NULL, -1, -1); |
78 EXPECT_FALSE(attribute->IsFulfilled(&url_request_fail, ON_BEFORE_REQUEST)); | 80 EXPECT_FALSE(attribute->IsFulfilled(&url_request_fail, ON_BEFORE_REQUEST)); |
79 } | 81 } |
80 | 82 |
81 } // namespace extensions | 83 } // namespace extensions |
OLD | NEW |