Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4846)

Unified Diff: content/browser/payments/payment_app_browsertest.cc

Issue 2895583002: PaymentHandler: Clear storage partition data during content_browsertests. (Closed)
Patch Set: PaymentHandler: Clear storage partition data during content_browsertests. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/payments/payment_app_browsertest.cc
diff --git a/content/browser/payments/payment_app_browsertest.cc b/content/browser/payments/payment_app_browsertest.cc
index 49791c7ffb915ae38dbb3b6edc6370e0ea8a161c..dcb4a21b09094a5fbce89566207aed312f19be35 100644
--- a/content/browser/payments/payment_app_browsertest.cc
+++ b/content/browser/payments/payment_app_browsertest.cc
@@ -6,6 +6,8 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "components/payments/mojom/payment_app.mojom.h"
+#include "content/browser/storage_partition_impl.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/payment_app_provider.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
@@ -114,6 +116,22 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
return response;
}
+ void ClearStoragePartitionData() {
+ // Clear data from the storage partition. Parameters are set to clear data
+ // for service workers, for all origins, for an unbounded time range.
+ base::RunLoop run_loop;
+
+ static_cast<StoragePartitionImpl*>(
+ content::BrowserContext::GetDefaultStoragePartition(
+ shell()->web_contents()->GetBrowserContext()))
+ ->ClearData(StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS,
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(),
+ StoragePartition::OriginMatcherFunction(), base::Time(),
+ base::Time::Max(), run_loop.QuitClosure());
+
+ run_loop.Run();
+ }
+
private:
std::unique_ptr<net::EmbeddedTestServer> https_server_;
@@ -128,6 +146,11 @@ IN_PROC_BROWSER_TEST_F(PaymentAppBrowserTest, PaymentAppInvocation) {
payments::mojom::PaymentAppResponsePtr response(InvokePaymentApp(ids[0]));
ASSERT_EQ("test", response->method_name);
+
+ ClearStoragePartitionData();
+
+ ids = GetAllPaymentAppIDs();
+ ASSERT_EQ(0U, ids.size());
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698