Index: ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm |
diff --git a/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm b/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..86bb5c9f215507328b344626adefe1a3bdeae321 |
--- /dev/null |
+++ b/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm |
@@ -0,0 +1,29 @@ |
+// Copyright 2017 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 "ios/chrome/browser/web/mailto_handler_system_mail.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "testing/gtest_mac.h" |
+#include "url/gurl.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+TEST(MailtoHandlerSystemMailTest, TestConstructor) { |
+ MailtoHandler* handler = [[MailtoHandlerSystemMail alloc] init]; |
+ EXPECT_TRUE(handler); |
+ EXPECT_NSEQ(@"Mail", [handler appName]); |
+ EXPECT_GT([[handler appStoreID] length], 0U); |
+ EXPECT_TRUE([handler isAvailable]); |
+} |
+ |
+TEST(MailtoHandlerSystemMailTest, TestRewrite) { |
+ MailtoHandler* handler = [[MailtoHandlerSystemMail alloc] init]; |
+ NSString* result = [handler rewriteMailtoURL:GURL("mailto:user@domain.com")]; |
+ EXPECT_NSEQ(@"mailto:user@domain.com", result); |
+ result = [handler rewriteMailtoURL:GURL("http://www.google.com")]; |
+ EXPECT_FALSE(result); |
+} |