blob: 274f663b24a0ad0a4751d765f98fbe2e70e3f761 [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
Brandon Maslen6134c852020-05-18 21:45:2110namespace content {
Brandon Maslen6134c852020-05-18 21:45:2111class RenderFrameHost;
12} // namespace content
13
14namespace storage {
15namespace test {
16
Chris Fredricksonf39f87b2022-07-11 11:34:0417// Gets the text content of a given frame.
18std::string GetFrameContent(content::RenderFrameHost* frame);
Brandon Maslen6134c852020-05-18 21:45:2119
20// Helpers to set and check various types of storage on a given frame. Typically
21// used on page like //chrome/test/data/browsing_data/site_data.html
22void SetStorageForFrame(content::RenderFrameHost* frame);
Asami Doibcbe9af2021-03-24 04:50:5223void SetStorageForWorker(content::RenderFrameHost* frame);
Brandon Maslen6134c852020-05-18 21:45:2124void ExpectStorageForFrame(content::RenderFrameHost* frame, bool expected);
Asami Doibcbe9af2021-03-24 04:50:5225void ExpectStorageForWorker(content::RenderFrameHost* frame, bool expected);
Brandon Maslen6134c852020-05-18 21:45:2126
27// Helpers to set and check various types of cross tab info for a given frame.
28// Typically used on page like //chrome/test/data/browsing_data/site_data.html
29void SetCrossTabInfoForFrame(content::RenderFrameHost* frame);
30void ExpectCrossTabInfoForFrame(content::RenderFrameHost* frame, bool expected);
31
32// Helper to request storage access for a frame using
Chris Fredricksonf39f87b2022-07-11 11:34:0433// document.requestStorageAccess(). Returns true if the promise resolves; false
34// if it rejects.
35bool RequestStorageAccessForFrame(content::RenderFrameHost* frame);
36// Helper to see if a frame currently has storage access using
37// document.hasStorageAccess(). Returns true if the promise resolves with a
38// value of true; false otherwise.
39bool HasStorageAccessForFrame(content::RenderFrameHost* frame);
Brandon Maslen6134c852020-05-18 21:45:2140
41} // namespace test
42} // namespace storage
43#endif // CHROME_BROWSER_NET_STORAGE_TEST_UTILS_H_