scoped_use_fake_instance_id_android.h 981 B

12345678910111213141516171819202122232425262728293031
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_SCOPED_USE_FAKE_INSTANCE_ID_ANDROID_H_
  5. #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_SCOPED_USE_FAKE_INSTANCE_ID_ANDROID_H_
  6. #include <jni.h>
  7. namespace instance_id {
  8. // Tests depending on InstanceID must use this, to avoid hitting the
  9. // network/disk. Also clears cached InstanceIDs when constructed/destructed.
  10. class ScopedUseFakeInstanceIDAndroid {
  11. public:
  12. ScopedUseFakeInstanceIDAndroid();
  13. ScopedUseFakeInstanceIDAndroid(const ScopedUseFakeInstanceIDAndroid&) =
  14. delete;
  15. ScopedUseFakeInstanceIDAndroid& operator=(
  16. const ScopedUseFakeInstanceIDAndroid&) = delete;
  17. ~ScopedUseFakeInstanceIDAndroid();
  18. private:
  19. bool previous_value_;
  20. };
  21. } // namespace instance_id
  22. #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_SCOPED_USE_FAKE_INSTANCE_ID_ANDROID_H_