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_action
.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_action
.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_condit
ion.h" | 9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit
ion.h" |
10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta
nts.h" | 10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta
nts.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 EXPECT_EQ("foo\\\\\\1bar", CallPerlToRe2Style("foo\\\\$1bar")); | 110 EXPECT_EQ("foo\\\\\\1bar", CallPerlToRe2Style("foo\\\\$1bar")); |
111 // foo\bar -> foobar | 111 // foo\bar -> foobar |
112 EXPECT_EQ("foobar", CallPerlToRe2Style("foo\\bar")); | 112 EXPECT_EQ("foobar", CallPerlToRe2Style("foo\\bar")); |
113 // foo$bar -> foo$bar | 113 // foo$bar -> foo$bar |
114 EXPECT_EQ("foo$bar", CallPerlToRe2Style("foo$bar")); | 114 EXPECT_EQ("foo$bar", CallPerlToRe2Style("foo$bar")); |
115 #undef CallPerlToRe2Style | 115 #undef CallPerlToRe2Style |
116 } | 116 } |
117 | 117 |
118 TEST(WebRequestActionTest, TestPermissions) { | 118 TEST(WebRequestActionTest, TestPermissions) { |
119 // Necessary for TestURLRequest. | 119 // Necessary for TestURLRequest. |
120 MessageLoop message_loop(MessageLoop::TYPE_IO); | 120 base::MessageLoop message_loop(base::MessageLoop::TYPE_IO); |
121 net::TestURLRequestContext context; | 121 net::TestURLRequestContext context; |
122 | 122 |
123 std::string error; | 123 std::string error; |
124 bool bad_message = false; | 124 bool bad_message = false; |
125 scoped_ptr<WebRequestActionSet> action_set; | 125 scoped_ptr<WebRequestActionSet> action_set; |
126 | 126 |
127 // Setup redirect to http://www.foobar.com. | 127 // Setup redirect to http://www.foobar.com. |
128 base::DictionaryValue redirect; | 128 base::DictionaryValue redirect; |
129 redirect.SetString(keys::kInstanceTypeKey, keys::kRedirectRequestType); | 129 redirect.SetString(keys::kInstanceTypeKey, keys::kRedirectRequestType); |
130 redirect.SetString(keys::kRedirectUrlKey, "http://www.foobar.com"); | 130 redirect.SetString(keys::kRedirectUrlKey, "http://www.foobar.com"); |
(...skipping 19 matching lines...) Expand all Loading... |
150 net::TestURLRequest protected_request(GURL("http://clients1.google.com"), | 150 net::TestURLRequest protected_request(GURL("http://clients1.google.com"), |
151 NULL, &context, NULL); | 151 NULL, &context, NULL); |
152 deltas.clear(); | 152 deltas.clear(); |
153 request_data = WebRequestData(&protected_request, ON_BEFORE_REQUEST); | 153 request_data = WebRequestData(&protected_request, ON_BEFORE_REQUEST); |
154 // Note that we just updated the request_data reference in apply_info. | 154 // Note that we just updated the request_data reference in apply_info. |
155 action_set->Apply("ext1", base::Time(), &apply_info); | 155 action_set->Apply("ext1", base::Time(), &apply_info); |
156 EXPECT_EQ(0u, deltas.size()); | 156 EXPECT_EQ(0u, deltas.size()); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |