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

Unified Diff: ios/chrome/browser/web/mailto_handler_gmail_unittest.mm

Issue 2852003002: Adds mailto: URL support to app launching. (Closed)
Patch Set: .grd message update 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
Index: ios/chrome/browser/web/mailto_handler_gmail_unittest.mm
diff --git a/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm b/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..aa236d58d6a4c0e495d1ec600e90f0ee7f1c1ba0
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm
@@ -0,0 +1,34 @@
+// 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_gmail.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(MailtoHandlerGmailTest, TestConstructor) {
+ MailtoHandlerGmail* handler = [[MailtoHandlerGmail alloc] init];
+ EXPECT_NSEQ(@"Gmail", [handler appName]);
+ EXPECT_NSEQ(@"422689480", [handler appStoreID]);
+}
+
+TEST(MailtoHandlerGmailTest, TestRewriteGood) {
+ MailtoHandlerGmail* handler = [[MailtoHandlerGmail alloc] init];
+ NSString* result = [handler rewriteMailtoURL:GURL("mailto:user@domain.com")];
+ EXPECT_NSEQ(@"googlegmail:/co?to=user@domain.com&", result);
+ result =
+ [handler rewriteMailtoURL:GURL("mailto:user@domain.com?subject=hello")];
+ EXPECT_NSEQ(@"googlegmail:/co?to=user@domain.com&subject=hello", result);
+}
+
+TEST(MailtoHandlerGmailTest, TestRewriteBad) {
+ MailtoHandlerGmail* handler = [[MailtoHandlerGmail alloc] init];
+ NSString* result = [handler rewriteMailtoURL:GURL("http://www.google.com")];
+ EXPECT_FALSE(result);
+}

Powered by Google App Engine
This is Rietveld 408576698