chromium/components/dom_distiller/standalone/content_extractor_browsertest.cc

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

#include <stddef.h>
#include <memory>
#include <sstream>
#include <unordered_map>
#include <utility>

#include "base/command_line.h"
#include "base/containers/id_map.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
#include "components/dom_distiller/content/browser/distiller_page_web_contents.h"
#include "components/dom_distiller/core/article_entry.h"
#include "components/dom_distiller/core/distilled_page_prefs.h"
#include "components/dom_distiller/core/distiller.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/dom_distiller/core/proto/distilled_article.pb.h"
#include "components/dom_distiller/core/proto/distilled_page.pb.h"
#include "components/dom_distiller/core/task_tracker.h"
#include "components/leveldb_proto/public/proto_database.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/content_browser_test.h"
#include "content/shell/browser/shell.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "net/dns/mock_host_resolver.h"
#include "third_party/dom_distiller_js/dom_distiller.pb.h"
#include "ui/base/resource/resource_bundle.h"

ContentBrowserTest;

namespace dom_distiller {

namespace {

FileToUrlMap;
}

// Factory for creating a Distiller that creates different DomDistillerOptions
// for different URLs, i.e. a specific kOriginalUrl option for each URL.
class TestDistillerFactoryImpl : public DistillerFactory {};

namespace {

// The url to distill.
const char* kUrlSwitch =;

// A space-separated list of urls to distill.
const char* kUrlsSwitch =;

// Indicates that DNS resolution should be disabled for this test.
const char* kDisableDnsSwitch =;

// Will write the distilled output to the given file instead of to stdout.
const char* kOutputFile =;

// Indicates to output a serialized protocol buffer instead of human-readable
// output.
const char* kShouldOutputBinary =;

// Indicates to output only the text of the article and not the enclosing html.
const char* kExtractTextOnly =;

// Indicates to include debug output.
const char* kDebugLevel =;

// The original URL of the page if |kUrlSwitch| is a file.
const char* kOriginalUrl =;

// A semi-colon-separated (i.e. ';') list of original URLs corresponding to
// "kUrlsSwitch".
const char* kOriginalUrls =;

// The pagination algorithm to use, one of "next", "pagenum".
const char* kPaginationAlgo =;

// Maximum number of concurrent started extractor requests.
const int kMaxExtractorTasks =;

std::unique_ptr<DomDistillerService> CreateDomDistillerService(
    content::BrowserContext* context,
    sync_preferences::TestingPrefServiceSyncable* pref_service,
    const FileToUrlMap& file_to_url_map) {}

void AddComponentsTestResources() {}

bool WriteProtobufWithSize(
    const google::protobuf::MessageLite& message,
    google::protobuf::io::ZeroCopyOutputStream* output_stream) {}

std::string GetReadableArticleString(
    const DistilledArticleProto& article_proto) {}

}  // namespace

class ContentExtractionRequest : public ViewRequestDelegate {};

class ContentExtractor : public ContentBrowserTest {};

IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) {}

}  // namespace dom_distiller