Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halle/remove browserserviceskit dep #2619

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,6 @@
B64C85422694590B0048FEBE /* PermissionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64C85412694590B0048FEBE /* PermissionButton.swift */; };
B64CE01E2B8622D700126CA5 /* AddressBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64CE01D2B8622D700126CA5 /* AddressBarTests.swift */; };
B64CE01F2B8622D700126CA5 /* AddressBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64CE01D2B8622D700126CA5 /* AddressBarTests.swift */; };
B64E42872B908501006C1346 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = B65CD8D22B316E1700A595BB /* SnapshotTesting */; };
B64E42AB2B909DC9006C1346 /* test.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B64E42AA2B909DC9006C1346 /* test.pdf */; };
B64E42AC2B909DC9006C1346 /* test.pdf in Resources */ = {isa = PBXBuildFile; fileRef = B64E42AA2B909DC9006C1346 /* test.pdf */; };
B65211252B29A42C00B30633 /* BookmarkStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA652CDA25DDAB32009059CC /* BookmarkStoreMock.swift */; };
Expand Down Expand Up @@ -3299,7 +3298,6 @@
EAFAD6CA2728BD1200F9DF00 /* clickToLoad.js in Resources */ = {isa = PBXBuildFile; fileRef = EAFAD6C92728BD1200F9DF00 /* clickToLoad.js */; };
EE02D41A2BB4609900DBE6B3 /* UITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE02D4192BB4609900DBE6B3 /* UITests.swift */; };
EE02D41C2BB460A600DBE6B3 /* BrowsingHistoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE02D41B2BB460A600DBE6B3 /* BrowsingHistoryTests.swift */; };
EE02D4202BB460C000DBE6B3 /* BrowserServicesKit in Frameworks */ = {isa = PBXBuildFile; productRef = EE02D41F2BB460C000DBE6B3 /* BrowserServicesKit */; };
EE02D4212BB460FE00DBE6B3 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF2624923EC70071C2E8 /* StringExtension.swift */; };
EE02D4222BB4611A00DBE6B3 /* TestsURLExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6EC37FB29B83E99001ACE79 /* TestsURLExtension.swift */; };
EE0429E02BA31D2F009EB20F /* FindInPageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0429DF2BA31D2F009EB20F /* FindInPageTests.swift */; };
Expand Down Expand Up @@ -5016,8 +5014,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
EE02D4202BB460C000DBE6B3 /* BrowserServicesKit in Frameworks */,
B64E42872B908501006C1346 /* SnapshotTesting in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -9271,8 +9267,6 @@
);
name = "UI Tests";
packageProductDependencies = (
B65CD8D22B316E1700A595BB /* SnapshotTesting */,
EE02D41F2BB460C000DBE6B3 /* BrowserServicesKit */,
);
productName = "UI Tests";
productReference = 7B4CE8DA26F02108009134B1 /* UI Tests.xctest */;
Expand Down Expand Up @@ -15156,11 +15150,6 @@
package = B65CD8C92B316DF100A595BB /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
productName = SnapshotTesting;
};
B65CD8D22B316E1700A595BB /* SnapshotTesting */ = {
isa = XCSwiftPackageProductDependency;
package = B65CD8C92B316DF100A595BB /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
productName = SnapshotTesting;
};
B6AE39F229374AEC00C37AA4 /* OHHTTPStubs */ = {
isa = XCSwiftPackageProductDependency;
package = B6DA44152616C13800DD1EC2 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */;
Expand Down Expand Up @@ -15231,11 +15220,6 @@
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Configuration;
};
EE02D41F2BB460C000DBE6B3 /* BrowserServicesKit */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = BrowserServicesKit;
};
EE2F9C5A2B90F2FF00D45FC9 /* Subscription */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
Expand Down
50 changes: 48 additions & 2 deletions IntegrationTests/Common/TestsURLExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
// limitations under the License.
//

import Foundation
import Common
import Foundation

// Integration Tests helpers
extension URL {

static let testsServer = URL(string: "http://localhost:8085/")!

/// used for Tests Server mock HTTP requests creation (see tests-server/main.swift)
Expand Down Expand Up @@ -61,5 +60,52 @@ extension URL {
}
return url
}
}

private extension URL {
func appendingParameter(name: String, value: String, allowedReservedCharacters: CharacterSet? = nil) -> URL {
let queryItem = URLQueryItem(percentEncodingName: name,
value: value,
withAllowedCharacters: allowedReservedCharacters)
return self.appending(percentEncodedQueryItem: queryItem)
}

func appending(percentEncodedQueryItem: URLQueryItem) -> URL {
guard var components = URLComponents(url: self, resolvingAgainstBaseURL: true) else { return self }

var percentEncodedQueryItems = components.percentEncodedQueryItems ?? [URLQueryItem]()
percentEncodedQueryItems.append(percentEncodedQueryItem)
components.percentEncodedQueryItems = percentEncodedQueryItems

return components.url ?? self
}
}

private extension URLQueryItem {
init(percentEncodingName name: String, value: String, withAllowedCharacters allowedReservedCharacters: CharacterSet? = nil) {
let allowedCharacters: CharacterSet = {
if let allowedReservedCharacters = allowedReservedCharacters {
return .urlQueryParameterAllowed.union(allowedReservedCharacters)
}
return .urlQueryParameterAllowed
}()

let percentEncodedName = name.percentEncoded(withAllowedCharacters: allowedCharacters)
let percentEncodedValue = value.percentEncoded(withAllowedCharacters: allowedCharacters)

self.init(name: percentEncodedName, value: percentEncodedValue)
}
}

private extension CharacterSet {
/**
* As per [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-2.2).
*
* This set contains all reserved characters that are otherwise
* included in `CharacterSet.urlQueryAllowed` but still need to be percent-escaped.
*/
static let urlQueryReserved = CharacterSet(charactersIn: ":/?#[]@!$&'()*+,;=")

static let urlQueryParameterAllowed = CharacterSet.urlQueryAllowed.subtracting(Self.urlQueryReserved)
static let urlQueryStringAllowed = CharacterSet(charactersIn: "%+?").union(.urlQueryParameterAllowed)
}
1 change: 0 additions & 1 deletion UITests/BookmarksBarTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// limitations under the License.
//

import Common
import XCTest

class BookmarksBarTests: XCTestCase {
Expand Down
Loading