Revision control

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
import UIKit
6
import XCTest
7
@testable import Client
8
import Shared
9
10
class FxADeepLinkingTests: XCTestCase {
11
var profile: MockProfile!
12
var vc: FxAContentViewController!
14
15
override func setUp() {
16
super.setUp()
17
self.profile = MockProfile()
18
self.vc = FxAContentViewController(profile: self.profile)
19
}
20
21
override func tearDown() {
22
self.profile._shutdown()
23
super.tearDown()
24
}
25
26
func testLaunchWithNilOptions() {
27
let testUrl = self.vc.createFxAURLWith(nil, profile: self.profile, isSignUpFlow: false)
28
// Should use default urls for nil options
29
XCTAssertEqual(testUrl, self.vc.profile.accountConfiguration.signInURL)
30
}
31
32
func testLaunchWithOptions() {
34
let query = url!.getQuery()
35
let fxaOptions = FxALaunchParams(query: query)
36
let testUrl = self.vc.createFxAURLWith(fxaOptions, profile: self.profile, isSignUpFlow: false)
37
let dict = testUrl.getQuery()
38
let expected = expectUrl!.getQuery()
39
XCTAssertTrue(dict.contains { (key, value) -> Bool in
40
return expected[key] != nil
41
})
42
}
43
44
func testDoesntOverrideServiceContext() {
46
let query = url!.getQuery()
47
let fxaOptions = FxALaunchParams(query: query)
48
let testUrl = self.vc.createFxAURLWith(fxaOptions, profile: self.profile, isSignUpFlow: false)
49
let dict = testUrl.getQuery()
50
let expected = expectUrl!.getQuery()
51
XCTAssertTrue(dict.contains { (key, value) -> Bool in
52
return expected[key] != nil
53
})
54
}
55
}