Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1309)

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc

Issue 10449069: Support redirects by regular expression in declarative WebRequest API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
index 1f36d717779e5b33c305a626cac266f45e35fec2..6473bb9b9be082b227f80185abb207b254ef27e6 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc
@@ -100,4 +100,20 @@ TEST(WebRequestActionTest, CreateActionSet) {
EXPECT_FALSE(result.get());
}
+// Test capture group syntax conversions of WebRequestRedirectByRegExAction
+TEST(WebRequestActionTest, PerlToRe2Style) {
+#define CallPerlToRe2Style WebRequestRedirectByRegExAction::PerlToRe2Style
+ // foo$1bar -> foo\1bar
+ EXPECT_EQ("foo\\1bar", CallPerlToRe2Style("foo$1bar"));
+ // foo\$1bar -> foo$1bar
+ EXPECT_EQ("foo$1bar", CallPerlToRe2Style("foo\\$1bar"));
+ // foo\\$1bar -> foo\\\1bar
+ EXPECT_EQ("foo\\\\\\1bar", CallPerlToRe2Style("foo\\\\$1bar"));
+ // foo\bar -> foobar
+ EXPECT_EQ("foobar", CallPerlToRe2Style("foo\\bar"));
+ // foo$bar -> foo$bar
+ EXPECT_EQ("foo$bar", CallPerlToRe2Style("foo$bar"));
+#undef CallPerlToRe2Style
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698