#include "components/gcm_driver/instance_id/instance_id_driver.h"
#include <stddef.h>
#include <cmath>
#include <memory>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/gcm_driver/gcm_buildflags.h"
#include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h"
#include "components/gcm_driver/instance_id/instance_id.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(USE_GCM_FROM_PLATFORM)
#include "components/gcm_driver/instance_id/instance_id_android.h"
#include "components/gcm_driver/instance_id/scoped_use_fake_instance_id_android.h"
#endif
namespace instance_id {
namespace {
const char kTestAppID1[] = …;
const char kTestAppID2[] = …;
const char kAuthorizedEntity1[] = …;
const char kAuthorizedEntity2[] = …;
const char kScope1[] = …;
const char kScope2[] = …;
bool VerifyInstanceID(const std::string& str) { … }
}
class InstanceIDDriverTest : public testing::Test { … };
InstanceIDDriverTest::InstanceIDDriverTest()
: … { … }
InstanceIDDriverTest::~InstanceIDDriverTest() { … }
void InstanceIDDriverTest::SetUp() { … }
void InstanceIDDriverTest::TearDown() { … }
void InstanceIDDriverTest::RecreateInstanceIDDriver() { … }
void InstanceIDDriverTest::WaitForAsyncOperation() { … }
std::string InstanceIDDriverTest::GetID(InstanceID* instance_id) { … }
base::Time InstanceIDDriverTest::GetCreationTime(InstanceID* instance_id) { … }
InstanceID::Result InstanceIDDriverTest::DeleteID(InstanceID* instance_id) { … }
std::string InstanceIDDriverTest::GetToken(InstanceID* instance_id,
const std::string& authorized_entity,
const std::string& scope) { … }
InstanceID::Result InstanceIDDriverTest::DeleteToken(
InstanceID* instance_id,
const std::string& authorized_entity,
const std::string& scope) { … }
void InstanceIDDriverTest::GetIDCompleted(const std::string& id) { … }
void InstanceIDDriverTest::GetCreationTimeCompleted(
const base::Time& creation_time) { … }
void InstanceIDDriverTest::DeleteIDCompleted(InstanceID::Result result) { … }
void InstanceIDDriverTest::GetTokenCompleted(
const std::string& token, InstanceID::Result result) { … }
void InstanceIDDriverTest::DeleteTokenCompleted(InstanceID::Result result) { … }
TEST_F(InstanceIDDriverTest, GetAndRemoveInstanceID) { … }
TEST_F(InstanceIDDriverTest, NewID) { … }
TEST_F(InstanceIDDriverTest, PersistID) { … }
TEST_F(InstanceIDDriverTest, DeleteID) { … }
TEST_F(InstanceIDDriverTest, GetToken) { … }
TEST_F(InstanceIDDriverTest, DeleteToken) { … }
}