web_state_policy_decider_test_util.mm 1.0 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2021 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. #import "ios/web/web_state/web_state_policy_decider_test_util.h"
  5. #if !defined(__has_feature) || !__has_feature(objc_arc)
  6. #error "This file requires ARC support."
  7. #endif
  8. namespace web {
  9. bool RequestInfoMatch(WebStatePolicyDecider::RequestInfo expected,
  10. WebStatePolicyDecider::RequestInfo got) {
  11. return ui::PageTransitionTypeIncludingQualifiersIs(
  12. got.transition_type, expected.transition_type) &&
  13. (got.target_frame_is_main == expected.target_frame_is_main) &&
  14. (got.target_frame_is_cross_origin ==
  15. expected.target_frame_is_cross_origin) &&
  16. (got.has_user_gesture == expected.has_user_gesture);
  17. }
  18. bool ResponseInfoMatch(WebStatePolicyDecider::ResponseInfo expected,
  19. WebStatePolicyDecider::ResponseInfo got) {
  20. return (got.for_main_frame == expected.for_main_frame);
  21. }
  22. } // namespace web