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

Unified Diff: content/renderer/android/email_detector_unittest.cc

Issue 2790893004: Delete Android content detectors. (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « content/renderer/android/email_detector.cc ('k') | content/renderer/android/phone_number_detector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/android/email_detector_unittest.cc
diff --git a/content/renderer/android/email_detector_unittest.cc b/content/renderer/android/email_detector_unittest.cc
deleted file mode 100644
index 020a0facc34e549a08fc70d0fb9c95c6f17e7a35..0000000000000000000000000000000000000000
--- a/content/renderer/android/email_detector_unittest.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/android/email_detector.h"
-
-#include <stddef.h>
-
-#include "base/strings/utf_string_conversions.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace content {
-
-class EmailDetectorTest : public testing::Test {
- public:
- static void FindAndCheckEmail(const std::string& content,
- const std::string& expected) {
- base::string16 content_16 = base::UTF8ToUTF16(content);
- base::string16 result_16;
- size_t start, end;
- EmailDetector detector;
- std::string content_text;
- if (detector.FindContent(content_16.begin(), content_16.end(),
- &start, &end, &content_text)) {
- result_16 = content_16.substr(start, end - start);
- }
- EXPECT_EQ(expected, base::UTF16ToUTF8(result_16));
- EXPECT_EQ(expected, content_text);
- }
-};
-
-TEST_F(EmailDetectorTest, FindEmail) {
- FindAndCheckEmail("please email test@testing.com", "test@testing.com");
- FindAndCheckEmail("please email test@123.456.co.uk.", "test@123.456.co.uk");
- FindAndCheckEmail("My email is 'a@b.org'.", "a@b.org");
- FindAndCheckEmail("123@bcd.org", "123@bcd.org");
- FindAndCheckEmail("[quitelongwelllongemailaddress@somequitelongdomain.org]",
- "quitelongwelllongemailaddress@somequitelongdomain.org");
- FindAndCheckEmail("Should find the first@email.org not the second@email.org",
- "first@email.org");
- FindAndCheckEmail("Email:HELLO@SOMETHING.COM", "HELLO@SOMETHING.COM");
- FindAndCheckEmail("Email SOMEONE@GOOGLE.COM for details.",
- "SOMEONE@GOOGLE.COM");
- FindAndCheckEmail("It's \"testadd@company.fr\"", "testadd@company.fr");
- FindAndCheckEmail("This is not an @emailaddress.com", "");
- FindAndCheckEmail("Apples @2.50 each", "");
- FindAndCheckEmail("Log on to google.com", "");
- FindAndCheckEmail("Try someone@, they might know.", "");
- FindAndCheckEmail("No, bob@com is not an email address.", "");
- FindAndCheckEmail("@", "");
- FindAndCheckEmail("Just bob @google.com", "");
- FindAndCheckEmail("Why not call larry@google and ask him.", "");
- FindAndCheckEmail("Lets test invalid invalid@email..com address", "");
- FindAndCheckEmail("Invalid dots are bad invalid@.email.com address", "");
-}
-
-} // namespace content
« no previous file with comments | « content/renderer/android/email_detector.cc ('k') | content/renderer/android/phone_number_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698