[Code Health] Rewrite test helpers to return values.

It's better to return a value instead of doing assertions in the
helper, so that test failures include the line number in the test
body, rather than the line number in the test helper.

This also grants tests the flexibility to differentiate expectations
from assertions during test setup (e.g. in api_browsertest.cc).

This CL also adds two expectations that were mistakenly omitted from
https://crrev.com/c/3749906.

Change-Id: Id22f16f020cf66cedaf20f7e17048a5905b322bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3750281
Reviewed-by: Maks Orlovich <[email protected]>
Reviewed-by: Vasilii Sukhanov <[email protected]>
Auto-Submit: Chris Fredrickson <[email protected]>
Commit-Queue: Vasilii Sukhanov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1022652}
diff --git a/chrome/browser/net/storage_test_utils.h b/chrome/browser/net/storage_test_utils.h
index 76b9796..274f663 100644
--- a/chrome/browser/net/storage_test_utils.h
+++ b/chrome/browser/net/storage_test_utils.h
@@ -7,25 +7,15 @@
 
 #include <string>
 
-class GURL;
-
 namespace content {
-class BrowserContext;
 class RenderFrameHost;
 }  // namespace content
 
 namespace storage {
 namespace test {
 
-// Helper to validate a given frame contains the |expected| contents as their
-// document body.
-void ExpectFrameContent(content::RenderFrameHost* frame,
-                        const std::string& expected);
-// Helper to validate a given for a given |context| and |host_url| that
-// |expected| cookies are present.
-void ExpectCookiesOnHost(content::BrowserContext* context,
-                         const GURL& host_url,
-                         const std::string& expected);
+// Gets the text content of a given frame.
+std::string GetFrameContent(content::RenderFrameHost* frame);
 
 // Helpers to set and check various types of storage on a given frame. Typically
 // used on page like //chrome/test/data/browsing_data/site_data.html
@@ -40,13 +30,13 @@
 void ExpectCrossTabInfoForFrame(content::RenderFrameHost* frame, bool expected);
 
 // Helper to request storage access for a frame using
-// document.requestStorageAccess()
-void RequestStorageAccessForFrame(content::RenderFrameHost* frame,
-                                  bool should_resolve);
-// Helper to validate if a frame currently has storage access using
-// document.hasStorageAccess()
-void CheckStorageAccessForFrame(content::RenderFrameHost* frame,
-                                bool access_expected);
+// document.requestStorageAccess(). Returns true if the promise resolves; false
+// if it rejects.
+bool RequestStorageAccessForFrame(content::RenderFrameHost* frame);
+// Helper to see if a frame currently has storage access using
+// document.hasStorageAccess(). Returns true if the promise resolves with a
+// value of true; false otherwise.
+bool HasStorageAccessForFrame(content::RenderFrameHost* frame);
 
 }  // namespace test
 }  // namespace storage