| Index: components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
|
| diff --git a/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc b/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
|
| index 0ee7f0b6320f07f2dafc1f3e97a0102ddd48b5cc..f5a40bf25c67e64e0ad802b44de55a7783f5ee9e 100644
|
| --- a/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
|
| +++ b/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
|
| @@ -9,9 +9,22 @@
|
| #include "base/rand_util.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "base/strings/stringprintf.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "components/gcm_driver/gcm_client.h"
|
|
|
| +namespace {
|
| +
|
| +std::string MakeKey(const std::string& app_id,
|
| + bool use_subtype,
|
| + const std::string& authorized_entity,
|
| + const std::string& scope) {
|
| + return base::StringPrintf("%d,%s,%s,%s", use_subtype, app_id.c_str(),
|
| + authorized_entity.c_str(), scope.c_str());
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace instance_id {
|
|
|
| FakeGCMDriverForInstanceID::FakeGCMDriverForInstanceID()
|
| @@ -53,13 +66,14 @@ void FakeGCMDriverForInstanceID::GetInstanceIDData(
|
|
|
| void FakeGCMDriverForInstanceID::GetToken(
|
| const std::string& app_id,
|
| + bool use_subtype,
|
| const std::string& authorized_entity,
|
| const std::string& scope,
|
| const std::map<std::string, std::string>& options,
|
| const GetTokenCallback& callback) {
|
| - std::string token;
|
| - std::string key = app_id + authorized_entity + scope;
|
| + std::string key = MakeKey(app_id, use_subtype, authorized_entity, scope);
|
| auto iter = tokens_.find(key);
|
| + std::string token;
|
| if (iter != tokens_.end()) {
|
| token = iter->second;
|
| } else {
|
| @@ -73,10 +87,11 @@ void FakeGCMDriverForInstanceID::GetToken(
|
|
|
| void FakeGCMDriverForInstanceID::DeleteToken(
|
| const std::string& app_id,
|
| + bool use_subtype,
|
| const std::string& authorized_entity,
|
| const std::string& scope,
|
| const DeleteTokenCallback& callback) {
|
| - std::string key = app_id + authorized_entity + scope;
|
| + std::string key = MakeKey(app_id, use_subtype, authorized_entity, scope);
|
| tokens_.erase(key);
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE, base::Bind(callback, gcm::GCMClient::SUCCESS));
|
|
|