#include <stdint.h>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_tokenizer.h"
#include "base/task/single_thread_task_runner.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gcm/engine/gcm_request_test_base.h"
#include "google_apis/gcm/engine/gcm_unregistration_request_handler.h"
#include "google_apis/gcm/engine/instance_id_delete_token_request_handler.h"
#include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
#include "net/base/load_flags.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace gcm {
namespace {
const int kMaxRetries = …;
const uint64_t kAndroidId = …;
const char kLoginHeader[] = …;
const char kAppId[] = …;
const char kDeletedAppId[] = …;
const char kDeletedToken[] = …;
const char kProductCategoryForSubtypes[] = …;
const char kRegistrationURL[] = …;
const uint64_t kSecurityToken = …;
const int kGCMVersion = …;
const char kInstanceId[] = …;
const char kDeveloperId[] = …;
const char kScope[] = …;
}
class UnregistrationRequestTest : public GCMRequestTestBase { … };
UnregistrationRequestTest::UnregistrationRequestTest()
: … { … }
UnregistrationRequestTest::~UnregistrationRequestTest() { … }
void UnregistrationRequestTest::UnregistrationCallback(
UnregistrationRequest::Status status) { … }
void UnregistrationRequestTest::OnAboutToCompleteFetch() { … }
class GCMUnregistrationRequestTest : public UnregistrationRequestTest { … };
GCMUnregistrationRequestTest::GCMUnregistrationRequestTest() { … }
GCMUnregistrationRequestTest::~GCMUnregistrationRequestTest() { … }
void GCMUnregistrationRequestTest::CreateRequest() { … }
TEST_F(GCMUnregistrationRequestTest, RequestDataPassedToFetcher) { … }
TEST_F(GCMUnregistrationRequestTest, SuccessfulUnregistration) { … }
TEST_F(GCMUnregistrationRequestTest, ResponseHttpStatusNotOK) { … }
TEST_F(GCMUnregistrationRequestTest, ResponseEmpty) { … }
TEST_F(GCMUnregistrationRequestTest, InvalidParametersError) { … }
TEST_F(GCMUnregistrationRequestTest, DeviceRegistrationError) { … }
TEST_F(GCMUnregistrationRequestTest, UnkwnownError) { … }
TEST_F(GCMUnregistrationRequestTest, ServiceUnavailable) { … }
TEST_F(GCMUnregistrationRequestTest, InternalServerError) { … }
TEST_F(GCMUnregistrationRequestTest, IncorrectAppId) { … }
TEST_F(GCMUnregistrationRequestTest, ResponseParsingFailed) { … }
TEST_F(GCMUnregistrationRequestTest, MaximumAttemptsReachedWithZeroRetries) { … }
TEST_F(GCMUnregistrationRequestTest, MaximumAttemptsReached) { … }
class InstaceIDDeleteTokenRequestTest : public UnregistrationRequestTest { … };
InstaceIDDeleteTokenRequestTest::InstaceIDDeleteTokenRequestTest() { … }
InstaceIDDeleteTokenRequestTest::~InstaceIDDeleteTokenRequestTest() { … }
void InstaceIDDeleteTokenRequestTest::CreateRequest(
bool use_subtype,
const std::string& instance_id,
const std::string& authorized_entity,
const std::string& scope) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, RequestDataPassedToFetcher) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, RequestDataWithSubtype) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, SuccessfulUnregistration) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, ResponseHttpStatusNotOK) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, InvalidParametersError) { … }
TEST_F(InstaceIDDeleteTokenRequestTest, UnkwnownError) { … }
}