#include <string_view>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/values_test_util.h"
#include "build/build_config.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.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/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_content_browser_client.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/base/url_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/ssl/ssl_server_config.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"
namespace content {
namespace {
void GetKey(const base::Value::Dict& dict,
const std::string& key,
std::string* out_value) { … }
void GetKey(const base::Value::Dict& dict,
const std::string& key,
int* out_value) { … }
void ExpectEqual(const base::Value::Dict& expected,
const base::Value::Dict& actual) { … }
const char kFileContent[] = …;
const size_t kFileSize = …;
}
class ServiceWorkerFileUploadTest : public testing::WithParamInterface<bool>,
public ContentBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsText) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsBlob) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsFormData) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, NetworkFallback) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest, AsFormData_CrossOrigin) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerFileUploadTest,
NetworkFallback_CrossOrigin) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_Subresource …
#else
#define MAYBE_Subresource …
#endif
IN_PROC_BROWSER_TEST_P(ServiceWorkerFileUploadTest, MAYBE_Subresource) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC)
#define MAYBE_Subresource_NonAsciiFilename …
#else
#define MAYBE_Subresource_NonAsciiFilename …
#endif
IN_PROC_BROWSER_TEST_P(ServiceWorkerFileUploadTest,
MAYBE_Subresource_NonAsciiFilename) { … }
INSTANTIATE_TEST_SUITE_P(…);
}