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

Side by Side Diff: ios/chrome/browser/web/external_app_launcher_unittest.mm

Issue 2580333003: Upstream Chrome on iOS source code [10/11]. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ios/chrome/browser/web/external_app_launcher.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/gtest_mac.h"
9
10 @interface ExternalAppLauncher (Private)
11 // Returns the Phone/FaceTime call argument from |url|.
12 // Made available for unit testing.
13 + (NSString*)formatCallArgument:(NSURL*)url;
14 @end
15
16 namespace {
17
18 TEST(ExternalAppLauncherTest, TestBadFormatCallArgument) {
19 EXPECT_NSEQ(@"garbage:",
20 [ExternalAppLauncher
21 formatCallArgument:[NSURL URLWithString:@"garbage:"]]);
22 EXPECT_NSEQ(@"malformed:////",
23 [ExternalAppLauncher
24 formatCallArgument:[NSURL URLWithString:@"malformed:////"]]);
25 }
26
27 TEST(ExternalAppLauncherTest, TestFormatCallArgument) {
28 EXPECT_NSEQ(
29 @"+1234",
30 [ExternalAppLauncher
31 formatCallArgument:[NSURL URLWithString:@"facetime://+1234"]]);
32 EXPECT_NSEQ(
33 @"+abcd",
34 [ExternalAppLauncher
35 formatCallArgument:[NSURL URLWithString:@"facetime-audio://+abcd"]]);
36 EXPECT_NSEQ(
37 @"+1-650-555-1212",
38 [ExternalAppLauncher
39 formatCallArgument:[NSURL URLWithString:@"tel://+1-650-555-1212"]]);
40 EXPECT_NSEQ(@"75009",
41 [ExternalAppLauncher
42 formatCallArgument:[NSURL URLWithString:@"garbage:75009"]]);
43 }
44
45 TEST(ExternalAppLauncherTest, TestURLEscapedArgument) {
46 EXPECT_NSEQ(@"+1 650 555 1212",
47 [ExternalAppLauncher
48 formatCallArgument:
49 [NSURL URLWithString:@"tel://+1%20650%20555%201212"]]);
50 }
51
52 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/external_app_launcher_disabler.mm ('k') | ios/chrome/browser/web/find_in_page_js_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698