chromium/chrome/browser/extensions/subscribe_page_action_browsertest.cc

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

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "net/test/embedded_test_server/embedded_test_server.h"

WebContents;

namespace extensions {

namespace {

const char kSubscribePageActionV2[] =;
const char kSubscribePageActionV3[] =;
const char kSubscribePage[] =;
const char kFeedPageMultiRel[] =;
const char kValidFeedNoLinks[] =;
const char kValidFeed0[] =;
const char kValidFeed1[] =;
const char kValidFeed2[] =;
const char kValidFeed3[] =;
const char kValidFeed4[] =;
const char kValidFeed5[] =;
const char kValidFeed6[] =;
const char kInvalidFeed1[] =;
const char kInvalidFeed2[] =;
// We need a triple encoded string to prove that we are not decoding twice in
// subscribe.js because one layer is also stripped off when subscribe.js passes
// it to the XMLHttpRequest object.
const char kFeedTripleEncoded[] =;

static const char kScriptFeedTitle[] =;
static const char kScriptAnchor[] =;
static const char kScriptDesc[] =;
static const char kScriptError[] =;

GURL GetFeedUrl(net::EmbeddedTestServer* server,
                const std::string& feed_page,
                bool direct_url,
                std::string extension_id) {}

class NamedFrameCreatedObserver : public content::WebContentsObserver {};

bool ValidatePageElement(content::RenderFrameHost* frame,
                         const std::string& javascript,
                         const std::string& expected_value) {}

// Navigates to a feed page and, if |sniff_xml_type| is set, wait for the
// extension to kick in, detect the feed and redirect to a feed preview page.
// |sniff_xml_type| is generally set to true if the feed is sniffable and false
// for invalid feeds.
void NavigateToFeedAndValidate(net::EmbeddedTestServer* server,
                               const std::string& url,
                               Browser* browser,
                               std::string extension_id,
                               bool sniff_xml_type,
                               const std::string& expected_feed_title,
                               const std::string& expected_item_title,
                               const std::string& expected_item_desc,
                               const std::string& expected_error,
                               std::string expected_msg) {}

} // namespace

// Makes sure that the RSS detects RSS feed links, even when rel tag contains
// more than just "alternate".
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed1) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed2) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed3) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed4) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed0) {}

// TODO(crbug.com/331144174): Re-enable this test
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_RSSParseFeedValidFeed5) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeed6) {}

// TODO(finnur): Once we're able to Closure-compile (via the Chrome build
//               process) the extension along with the HTML sanitizer, we should
//               add a test to confirm <img src="foo.jpg" alt="foo" /> is
//               preserved after sanitizing (the xkcd test).

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed1) {}

// TODO(https://crbug.com/331144174): Test is flaky across multiple builders.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest,
                       DISABLED_RSSParseFeedInvalidFeed2) {}

// TODO(https://crbug.com/331144174): Flaky on ASan LSan.
#if defined(ADDRESS_SANITIZER) && defined(LEAK_SANITIZER)
#define MAYBE_RSSParseFeedInvalidFeed3
#else
#define MAYBE_RSSParseFeedInvalidFeed3
#endif
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_RSSParseFeedInvalidFeed3) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedInvalidFeed4) {}

IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSParseFeedValidFeedNoLinks) {}

}  // namespace extensions