blob: 76b9796b4eb8164fe9703ccc169bda31a31b0233 [file] [log] [blame]
Brandon Maslen6134c852020-05-18 21:45:211// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_NET_STORAGE_TEST_UTILS_H_
6#define CHROME_BROWSER_NET_STORAGE_TEST_UTILS_H_
7
8#include <string>
9
10class GURL;
11
12namespace content {
13class BrowserContext;
14class RenderFrameHost;
15} // namespace content
16
17namespace storage {
18namespace test {
19
20// Helper to validate a given frame contains the |expected| contents as their
21// document body.
22void ExpectFrameContent(content::RenderFrameHost* frame,
23 const std::string& expected);
24// Helper to validate a given for a given |context| and |host_url| that
25// |expected| cookies are present.
26void ExpectCookiesOnHost(content::BrowserContext* context,
27 const GURL& host_url,
28 const std::string& expected);
29
30// Helpers to set and check various types of storage on a given frame. Typically
31// used on page like //chrome/test/data/browsing_data/site_data.html
32void SetStorageForFrame(content::RenderFrameHost* frame);
Asami Doibcbe9af2021-03-24 04:50:5233void SetStorageForWorker(content::RenderFrameHost* frame);
Brandon Maslen6134c852020-05-18 21:45:2134void ExpectStorageForFrame(content::RenderFrameHost* frame, bool expected);
Asami Doibcbe9af2021-03-24 04:50:5235void ExpectStorageForWorker(content::RenderFrameHost* frame, bool expected);
Brandon Maslen6134c852020-05-18 21:45:2136
37// Helpers to set and check various types of cross tab info for a given frame.
38// Typically used on page like //chrome/test/data/browsing_data/site_data.html
39void SetCrossTabInfoForFrame(content::RenderFrameHost* frame);
40void ExpectCrossTabInfoForFrame(content::RenderFrameHost* frame, bool expected);
41
42// Helper to request storage access for a frame using
43// document.requestStorageAccess()
44void RequestStorageAccessForFrame(content::RenderFrameHost* frame,
45 bool should_resolve);
46// Helper to validate if a frame currently has storage access using
47// document.hasStorageAccess()
48void CheckStorageAccessForFrame(content::RenderFrameHost* frame,
49 bool access_expected);
50
51} // namespace test
52} // namespace storage
53#endif // CHROME_BROWSER_NET_STORAGE_TEST_UTILS_H_