Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: chrome/browser/extensions/api/copresence/copresence_translations.cc

Issue 441103002: Tests for the Copresence API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api
Patch Set: Renaming to simply CopresenceDelegate Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/copresence/copresence_translations.h" 5 #include "chrome/browser/extensions/api/copresence/copresence_translations.h"
6 6
7 #include "chrome/common/extensions/api/copresence.h" 7 #include "chrome/common/extensions/api/copresence.h"
8 #include "components/copresence/proto/data.pb.h" 8 #include "components/copresence/proto/data.pb.h"
9 #include "components/copresence/proto/enums.pb.h" 9 #include "components/copresence/proto/enums.pb.h"
10 #include "components/copresence/proto/rpcs.pb.h" 10 #include "components/copresence/proto/rpcs.pb.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 VLOG(2) << "Overwriting subscription id \"" << subscription.id 123 VLOG(2) << "Overwriting subscription id \"" << subscription.id
124 << "\" for app \"" << app_id << "\""; 124 << "\" for app \"" << app_id << "\"";
125 } else { 125 } else {
126 // A conflicting association exists already. 126 // A conflicting association exists already.
127 VLOG(1) << "Subscription id \"" << subscription.id 127 VLOG(1) << "Subscription id \"" << subscription.id
128 << "\" used by two apps: \"" << previous_subscription->second 128 << "\" used by two apps: \"" << previous_subscription->second
129 << "\" and \"" << app_id << "\""; 129 << "\" and \"" << app_id << "\"";
130 return false; 130 return false;
131 } 131 }
132 132
133 // Convert from client to server subscription format. 133 // Convert from IDL to server subscription format.
134 copresence::Subscription* subscription_proto = 134 copresence::Subscription* subscription_proto =
135 request->mutable_manage_subscriptions_request()->add_subscription(); 135 request->mutable_manage_subscriptions_request()->add_subscription();
136 subscription_proto->set_id(subscription.id); 136 subscription_proto->set_id(subscription.id);
137 int ttl = SanitizeTtl(subscription.time_to_live_millis.get()); 137 int ttl = SanitizeTtl(subscription.time_to_live_millis.get());
138 if (ttl < 0) 138 if (ttl < 0)
139 return false; 139 return false;
140 subscription_proto->set_ttl_millis(ttl); 140 subscription_proto->set_ttl_millis(ttl);
141 141
142 subscription_proto->mutable_message_type()->set_type( 142 subscription_proto->mutable_message_type()->set_type(
143 subscription.filter.type); 143 subscription.filter.type);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 apps_by_subscription_id, 217 apps_by_subscription_id,
218 request)) 218 request))
219 return false; 219 return false;
220 } 220 }
221 } 221 }
222 222
223 return true; 223 return true;
224 } 224 }
225 225
226 } // namespace extensions 226 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/copresence/copresence_api_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698