| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browsing_data/media_licenses_counter.h" | 5 #include "chrome/browser/browsing_data/media_licenses_counter.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/common/pref_names.h" | |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 12 #include "components/browsing_data/pref_names.h" |
| 13 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
| 16 #include "ppapi/shared_impl/ppapi_constants.h" | 16 #include "ppapi/shared_impl/ppapi_constants.h" |
| 17 #include "storage/browser/fileapi/async_file_util.h" | 17 #include "storage/browser/fileapi/async_file_util.h" |
| 18 #include "storage/browser/fileapi/file_system_context.h" | 18 #include "storage/browser/fileapi/file_system_context.h" |
| 19 #include "storage/browser/fileapi/file_system_operation_context.h" | 19 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 20 #include "storage/browser/fileapi/isolated_context.h" | 20 #include "storage/browser/fileapi/isolated_context.h" |
| 21 #include "storage/browser/quota/quota_manager.h" | 21 #include "storage/browser/quota/quota_manager.h" |
| 22 #include "storage/common/fileapi/file_system_util.h" | 22 #include "storage/common/fileapi/file_system_util.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const char kTestOrigin[] = "https://host1/"; | 27 const char kTestOrigin[] = "https://host1/"; |
| 28 const GURL kOrigin(kTestOrigin); | 28 const GURL kOrigin(kTestOrigin); |
| 29 const char kClearKeyCdmPluginId[] = "application_x-ppapi-clearkey-cdm"; | 29 const char kClearKeyCdmPluginId[] = "application_x-ppapi-clearkey-cdm"; |
| 30 | 30 |
| 31 class MediaLicensesCounterTest : public InProcessBrowserTest { | 31 class MediaLicensesCounterTest : public InProcessBrowserTest { |
| 32 public: | 32 public: |
| 33 void SetUpOnMainThread() override { SetMediaLicenseDeletionPref(true); } | 33 void SetUpOnMainThread() override { SetMediaLicenseDeletionPref(true); } |
| 34 | 34 |
| 35 void SetMediaLicenseDeletionPref(bool value) { | 35 void SetMediaLicenseDeletionPref(bool value) { |
| 36 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDeleteMediaLicenses, | 36 browser()->profile()->GetPrefs()->SetBoolean( |
| 37 value); | 37 browsing_data::prefs::kDeleteMediaLicenses, value); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Create some test data for origin |kOrigin|. | 40 // Create some test data for origin |kOrigin|. |
| 41 void CreateMediaLicenseTestData() { | 41 void CreateMediaLicenseTestData() { |
| 42 storage::FileSystemContext* filesystem_context = | 42 storage::FileSystemContext* filesystem_context = |
| 43 content::BrowserContext::GetDefaultStoragePartition( | 43 content::BrowserContext::GetDefaultStoragePartition( |
| 44 browser()->profile()) | 44 browser()->profile()) |
| 45 ->GetFileSystemContext(); | 45 ->GetFileSystemContext(); |
| 46 std::string clearkey_fsid = | 46 std::string clearkey_fsid = |
| 47 CreateFileSystem(filesystem_context, kClearKeyCdmPluginId, kOrigin); | 47 CreateFileSystem(filesystem_context, kClearKeyCdmPluginId, kOrigin); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 SetMediaLicenseDeletionPref(true); | 212 SetMediaLicenseDeletionPref(true); |
| 213 | 213 |
| 214 RunAndWaitForResult(); | 214 RunAndWaitForResult(); |
| 215 | 215 |
| 216 EXPECT_TRUE(CallbackCalled()); | 216 EXPECT_TRUE(CallbackCalled()); |
| 217 EXPECT_EQ(0u, GetCount()); | 217 EXPECT_EQ(0u, GetCount()); |
| 218 EXPECT_TRUE(GetOrigin().empty()); | 218 EXPECT_TRUE(GetOrigin().empty()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace | 221 } // namespace |
| OLD | NEW |