1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30

fuchsia_web / webengine / browser / fake_navigation_policy_provider.cc [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "fuchsia_web/webengine/browser/fake_navigation_policy_provider.h"

#include "base/notreached.h"
#include "testing/gtest/include/gtest/gtest.h"

FakeNavigationPolicyProvider::FakeNavigationPolicyProvider() = default;

FakeNavigationPolicyProvider::~FakeNavigationPolicyProvider() = default;

void FakeNavigationPolicyProvider::EvaluateRequestedNavigation(
    fuchsia::web::RequestedNavigation requested_navigation,
    EvaluateRequestedNavigationCallback callback) {
  fuchsia::web::NavigationDecision decision;
  if (should_abort_navigation_) {
    callback(decision.WithAbort(fuchsia::web::NoArgumentsAction()));
  } else {
    callback(decision.WithProceed(fuchsia::web::NoArgumentsAction()));
  }

  requested_navigation_ = std::move(requested_navigation);
  num_evaluated_navigations_++;
}

void FakeNavigationPolicyProvider::NotImplemented_(const std::string& name) {
  NOTIMPLEMENTED() << name;
}