Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroboron committed Jan 10, 2025
1 parent 46f15da commit f575a61
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
webView.setCurrentURL(url)
sut.attachWebView(webView)
let navigationAction = MockNavigationAction(request: URLRequest(url: url))
sut.handleDecidePolicyFor(navigationAction: navigationAction, webView: webView)
sut.handleDecidePolicy(for: navigationAction, webView: webView)
let response = MockNavigationResponse.with(url: url)

await confirmation(expectedCount: 0) { receivedHTML in
Expand All @@ -309,7 +309,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let result = await sut.handleDecidePolicyfor(navigationResponse: response, webView: webView)
let result = await sut.handleDecidePolicy(for: response, webView: webView)

// THEN
#expect(!result)
Expand All @@ -324,7 +324,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
webView.setCurrentURL(url)
sut.attachWebView(webView)
let navigationAction = MockNavigationAction(request: URLRequest(url: url))
sut.handleDecidePolicyFor(navigationAction: navigationAction, webView: webView)
sut.handleDecidePolicy(for: navigationAction, webView: webView)
let response = MockNavigationResponse.with(url: url)

var expectedHTML: String?
Expand All @@ -336,7 +336,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let result = await sut.handleDecidePolicyfor(navigationResponse: response, webView: webView)
let result = await sut.handleDecidePolicy(for: response, webView: webView)

// THEN
#expect(result)
Expand All @@ -345,7 +345,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
#expect(sut.isSpecialErrorPageRequest)
#expect(sut.isSpecialErrorPageVisible)
let html = try #require(expectedHTML)
#expect(html.contains("Warning: This site puts your personal information at risk"))
#expect(html.contains("Warning: This site may put your personal information at risk"))
#expect(html.contains("This website may be impersonating a legitimate site in order to trick you into providing personal information, such as passwords or credit card numbers."))
}
}
Expand All @@ -359,7 +359,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
webView.setCurrentURL(url)
sut.attachWebView(webView)
let navigationAction = MockNavigationAction(request: URLRequest(url: url))
sut.handleDecidePolicyFor(navigationAction: navigationAction, webView: webView)
sut.handleDecidePolicy(for: navigationAction, webView: webView)
let response = MockNavigationResponse.with(url: url)

await confirmation(expectedCount: 0) { receivedHTML in
Expand All @@ -368,7 +368,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let result = await sut.handleDecidePolicyfor(navigationResponse: response, webView: webView)
let result = await sut.handleDecidePolicy(for: response, webView: webView)

// THEN
#expect(!result)
Expand All @@ -385,7 +385,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
let maliciousURL = try #require(URL(string: "http://privacy-test-pages.site/security/badware/phishing.html"))
webView.setCurrentURL(maliciousURL)
let maliciousSiteNavigationAction = MockNavigationAction(request: URLRequest(url: maliciousURL))
sut.handleDecidePolicyFor(navigationAction: maliciousSiteNavigationAction, webView: webView)
sut.handleDecidePolicy(for: maliciousSiteNavigationAction, webView: webView)
let maliciousSiteResponse = MockNavigationResponse.with(url: maliciousURL)

await confirmation { receivedHTML in
Expand All @@ -394,7 +394,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let maliciousResult = await sut.handleDecidePolicyfor(navigationResponse: maliciousSiteResponse, webView: webView)
let maliciousResult = await sut.handleDecidePolicy(for: maliciousSiteResponse, webView: webView)

// THEN
#expect(maliciousResult)
Expand All @@ -410,7 +410,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
let safeURL = try #require(URL(string: "http://broken.third-party.site/"))
webView.setCurrentURL(safeURL)
let safeSiteNavigationAction = MockNavigationAction(request: URLRequest(url: safeURL))
sut.handleDecidePolicyFor(navigationAction: safeSiteNavigationAction, webView: webView)
sut.handleDecidePolicy(for: safeSiteNavigationAction, webView: webView)
let safeSiteResponse = MockNavigationResponse.with(url: safeURL)

await confirmation(expectedCount: 0) { receivedHTML in
Expand All @@ -419,7 +419,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let result = await sut.handleDecidePolicyfor(navigationResponse: safeSiteResponse, webView: webView)
let result = await sut.handleDecidePolicy(for: safeSiteResponse, webView: webView)

// THEN
#expect(!result)
Expand All @@ -436,7 +436,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
let maliciousURL = try #require(URL(string: "http://privacy-test-pages.site/security/badware/phishing.html"))
webView.setCurrentURL(maliciousURL)
let maliciousSiteNavigationAction = MockNavigationAction(request: URLRequest(url: maliciousURL))
sut.handleDecidePolicyFor(navigationAction: maliciousSiteNavigationAction, webView: webView)
sut.handleDecidePolicy(for: maliciousSiteNavigationAction, webView: webView)
let maliciousSiteResponse = MockNavigationResponse.with(url: maliciousURL)

await confirmation { receivedHTML in
Expand All @@ -445,7 +445,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let maliciousResult = await sut.handleDecidePolicyfor(navigationResponse: maliciousSiteResponse, webView: webView)
let maliciousResult = await sut.handleDecidePolicy(for: maliciousSiteResponse, webView: webView)

// THEN
#expect(maliciousResult)
Expand All @@ -461,7 +461,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
let safeURL = try #require(URL(string: "http://duckduckgo.com/"))
webView.setCurrentURL(safeURL)
let safeSiteNavigationAction = MockNavigationAction(request: URLRequest(url: safeURL))
sut.handleDecidePolicyFor(navigationAction: safeSiteNavigationAction, webView: webView)
sut.handleDecidePolicy(for: safeSiteNavigationAction, webView: webView)
let safeSiteResponse = MockNavigationResponse.with(url: safeURL)

await confirmation(expectedCount: 0) { receivedHTML in
Expand All @@ -470,7 +470,7 @@ final class SpecialErrorPageNavigationHandlerIntegrationTests {
}

// WHEN
let result = await sut.handleDecidePolicyfor(navigationResponse: safeSiteResponse, webView: webView)
let result = await sut.handleDecidePolicy(for: safeSiteResponse, webView: webView)

// THEN
#expect(!result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final class SpecialErrorPageNavigationHandlerTests {
maliciousSiteProtectionNavigationHandler.task = Task {
.navigationHandled(.mainFrame(MaliciousSiteDetectionNavigationResponse(navigationAction: maliciousNavigationAction, errorData: errorData)))
}
_ = await sut.handleDecidePolicyfor(navigationResponse: maliciousNavigationResponse, webView: webView)
_ = await sut.handleDecidePolicy(for: maliciousNavigationResponse, webView: webView)
#expect(sut.errorData == errorData)
#expect(sut.failedURL == maliciousURL)

Expand All @@ -86,7 +86,7 @@ final class SpecialErrorPageNavigationHandlerTests {
let navigationAction = MockNavigationAction(request: URLRequest(url: url), targetFrame: MockFrameInfo(isMainFrame: true))

// WHEN
sut.handleDecidePolicyFor(navigationAction: navigationAction, webView: webView)
sut.handleDecidePolicy(for: navigationAction, webView: webView)

// THEN
#expect(sut.errorData == nil)
Expand Down

0 comments on commit f575a61

Please sign in to comment.