chromium/content/browser/download/save_package_browsertest.cc

// Copyright 2011 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/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/save_package.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/download_test_observer.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_download_manager_delegate.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace content {

namespace {

const char kTestFile[] =;

class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate {};

class DownloadicidalObserver : public DownloadManager::Observer {};

class DownloadCompleteObserver : public DownloadManager::Observer {};

}  // namespace

class SavePackageBrowserTest : public ContentBrowserTest {};

// Create a SavePackage and delete it without calling Init.
// SavePackage dtor has various asserts/checks that should not fire.
IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ImplicitCancel) {}

// Create a SavePackage, call Cancel, then delete it.
// SavePackage dtor has various asserts/checks that should not fire.
IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, ExplicitCancel) {}

IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, DownloadItemDestroyed) {}

IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, DownloadItemCanceled) {}

// Create a SavePackage and reload the page. This tests that when the
// Reload destroys the primary Page SavePackage's ContinueSaveInfo
// will not crash with a destroyed Page reference.
IN_PROC_BROWSER_TEST_F(SavePackageBrowserTest, Reload) {}

class SavePackageFencedFrameBrowserTest : public SavePackageBrowserTest {};

// If fenced frames become savable, this test will need to be updated.
// See https://crbug.com/1321102
IN_PROC_BROWSER_TEST_F(SavePackageFencedFrameBrowserTest,
                       IgnoreFencedFrameInMHTML) {}

}  // namespace content