OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRegularExpression.
h" | 6 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRegularExpression.
h" |
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
y.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivit
y.h" |
9 | 9 |
10 using namespace WebKit; | 10 using WebKit::WebRegularExpression; |
| 11 using WebKit::WebString; |
| 12 using WebKit::WebTextCaseInsensitive; |
| 13 using WebKit::WebTextCaseSensitive; |
| 14 using WebKit::WebUChar; |
11 | 15 |
12 namespace { | 16 namespace { |
13 | 17 |
14 class RegexTest : public testing::Test { | 18 class RegexTest : public testing::Test { |
15 }; | 19 }; |
16 | 20 |
17 struct Match { | 21 struct Match { |
18 const WebUChar* text; | 22 const WebUChar* text; |
19 const int textLength; | 23 const int textLength; |
20 const int matchPosition; | 24 const int matchPosition; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 100 |
97 testMatches(regex, matches, arraysize(matches)); | 101 testMatches(regex, matches, arraysize(matches)); |
98 } | 102 } |
99 | 103 |
100 TEST(RegexTest, EmptyMatch) { | 104 TEST(RegexTest, EmptyMatch) { |
101 WebRegularExpression regex("|x", WebTextCaseInsensitive); | 105 WebRegularExpression regex("|x", WebTextCaseInsensitive); |
102 int matchedLength = 0; | 106 int matchedLength = 0; |
103 EXPECT_EQ(0, regex.match("", 0, &matchedLength)); | 107 EXPECT_EQ(0, regex.match("", 0, &matchedLength)); |
104 EXPECT_EQ(0, matchedLength); | 108 EXPECT_EQ(0, matchedLength); |
105 } | 109 } |
OLD | NEW |