blob: b997843b4009066f2383a7db144cf490cb2aec20 [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);
33void ExpectStorageForFrame(content::RenderFrameHost* frame, bool expected);
34
35// Helpers to set and check various types of cross tab info for a given frame.
36// Typically used on page like //chrome/test/data/browsing_data/site_data.html
37void SetCrossTabInfoForFrame(content::RenderFrameHost* frame);
38void ExpectCrossTabInfoForFrame(content::RenderFrameHost* frame, bool expected);
39
40// Helper to request storage access for a frame using
41// document.requestStorageAccess()
42void RequestStorageAccessForFrame(content::RenderFrameHost* frame,
43 bool should_resolve);
44// Helper to validate if a frame currently has storage access using
45// document.hasStorageAccess()
46void CheckStorageAccessForFrame(content::RenderFrameHost* frame,
47 bool access_expected);
48
49} // namespace test
50} // namespace storage
51#endif // CHROME_BROWSER_NET_STORAGE_TEST_UTILS_H_