Chromium Code Reviews| 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..a174110033c65580ab1355b59124cb9f18d8f594 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,30 @@ 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. |
| + StoragePartitionImpl* storage = static_cast<StoragePartitionImpl*>( |
| + content::BrowserContext::GetDefaultStoragePartition( |
| + shell()->web_contents()->GetBrowserContext())); |
| + |
| + uint32_t storage_partition_mask = |
| + StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; |
| + uint32_t quota_storage_mask = |
| + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL; |
| + const GURL& delete_origin = GURL(); |
| + const base::Time delete_begin = base::Time(); |
| + base::Time delete_end = base::Time::Max(); |
| + |
| + base::RunLoop run_loop; |
| + |
| + storage->ClearData(storage_partition_mask, quota_storage_mask, |
| + delete_origin, StoragePartition::OriginMatcherFunction(), |
| + delete_begin, delete_end, run_loop.QuitClosure()); |
| + |
| + run_loop.Run(); |
|
please use gerrit instead
2017/05/19 14:23:43
Can you replace this implementation with these thr
zino
2017/05/21 11:52:57
Done.
|
| + } |
| + |
| private: |
| std::unique_ptr<net::EmbeddedTestServer> https_server_; |
| @@ -128,6 +154,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 |