fake_navigation_policy_provider.cc 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2020 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. #include "fuchsia_web/webengine/browser/fake_navigation_policy_provider.h"
  5. #include "base/notreached.h"
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. FakeNavigationPolicyProvider::FakeNavigationPolicyProvider() = default;
  8. FakeNavigationPolicyProvider::~FakeNavigationPolicyProvider() = default;
  9. void FakeNavigationPolicyProvider::EvaluateRequestedNavigation(
  10. fuchsia::web::RequestedNavigation requested_navigation,
  11. EvaluateRequestedNavigationCallback callback) {
  12. fuchsia::web::NavigationDecision decision;
  13. if (should_abort_navigation_) {
  14. callback(decision.WithAbort(fuchsia::web::NoArgumentsAction()));
  15. } else {
  16. callback(decision.WithProceed(fuchsia::web::NoArgumentsAction()));
  17. }
  18. requested_navigation_ = std::move(requested_navigation);
  19. num_evaluated_navigations_++;
  20. }
  21. void FakeNavigationPolicyProvider::NotImplemented_(const std::string& name) {
  22. NOTIMPLEMENTED() << name;
  23. }