#include <string.h>
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_isolated_world_ids.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
#include "components/dom_distiller/content/browser/dom_distiller_viewer_source.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/dom_distiller_switches.h"
#include "components/dom_distiller/core/fake_distiller.h"
#include "components/dom_distiller/core/fake_distiller_page.h"
#include "components/dom_distiller/core/task_tracker.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/dom_distiller/core/url_utils.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/base/url_util.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
namespace dom_distiller {
FakeDistiller;
MockDistillerFactory;
MockDistillerPage;
MockDistillerPageFactory;
Eq;
ExplainMatchResult;
HasSubstr;
Not;
namespace {
const char kGetLoadIndicatorClassName[] = …;
const char kGetContent[] = …;
const char kGetTitle[] = …;
const char kGetBodyClass[] = …;
const char kGetFontSize[] = …;
const unsigned kDarkToolbarThemeColor = …;
const char kTestDistillerObject[] = …;
void ExpectBodyHasThemeAndFont(content::WebContents* contents,
const std::string& expected_theme,
const std::string& expected_font) { … }
class PrefChangeObserver : public DistilledPagePrefs::Observer { … };
}
class DomDistillerViewerSourceBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
NoWebUIBindingsArticleNotFound) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
NoWebUIBindingsViewUrl) { … }
void DomDistillerViewerSourceBrowserTest::ViewSingleDistilledPage(
const GURL& url,
const std::string& expected_mime_type) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
TestBadUrlErrorPage) { … }
void DomDistillerViewerSourceBrowserTest::
ViewSingleDistilledPageAndExpectErrorPage(const GURL& url) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
NoWebUIBindingsDisplayCSS) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
EmptyURLShouldNotCrash) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
InvalidURLShouldNotCrash) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
InvalidURLShouldGetErrorPage) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, EarlyTemplateLoad) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
DISABLED_DistillerJavaScriptExposed) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
DistillerJavaScriptNotInMainWorld) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest,
DistillerJavaScriptNotExposed) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, MultiPageArticle) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, PrefChange) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, PrefChangeError) { … }
void DomDistillerViewerSourceBrowserTest::PrefTest(bool is_error_page) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, PrefPersist) { … }
IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, UISetsPrefs) { … }
}