external_clear_key_test_helper.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2015 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. #ifndef MEDIA_CDM_EXTERNAL_CLEAR_KEY_TEST_HELPER_H_
  5. #define MEDIA_CDM_EXTERNAL_CLEAR_KEY_TEST_HELPER_H_
  6. #include <string>
  7. #include "base/files/file_path.h"
  8. #include "base/scoped_native_library.h"
  9. #include "media/base/cdm_config.h"
  10. namespace media {
  11. // This class loads the library containing External Clear Key. The library is
  12. // loaded and initialized in the constructor, and unloaded in the destructor.
  13. class ExternalClearKeyTestHelper {
  14. public:
  15. ExternalClearKeyTestHelper();
  16. ExternalClearKeyTestHelper(const ExternalClearKeyTestHelper&) = delete;
  17. ExternalClearKeyTestHelper& operator=(const ExternalClearKeyTestHelper&) =
  18. delete;
  19. ~ExternalClearKeyTestHelper();
  20. media::CdmConfig CdmConfig() {
  21. return {"org.chromium.externalclearkey", false, false, false};
  22. }
  23. base::FilePath LibraryPath() { return library_path_; }
  24. private:
  25. // Methods to load and unload the library. Required as the compiler
  26. // doesn't like ASSERTs in the constructor/destructor.
  27. void LoadLibrary();
  28. void UnloadLibrary();
  29. // Keep a reference to the loaded library.
  30. base::FilePath library_path_;
  31. base::ScopedNativeLibrary library_;
  32. };
  33. } // namespace media
  34. #endif // MEDIA_CDM_EXTERNAL_CLEAR_KEY_TEST_HELPER_H_