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

Unified Diff: components/copresence/rpc/rpc_handler_unittest.cc

Issue 469883002: Using API key specified from js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing API build 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/copresence/rpc/rpc_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/rpc/rpc_handler_unittest.cc
diff --git a/components/copresence/rpc/rpc_handler_unittest.cc b/components/copresence/rpc/rpc_handler_unittest.cc
index bcdace5254d61b84b0254c476ab1167382b18914..7657f665ac8229db44913a8aef8567634629c9c4 100644
--- a/components/copresence/rpc/rpc_handler_unittest.cc
+++ b/components/copresence/rpc/rpc_handler_unittest.cc
@@ -25,6 +25,8 @@ namespace copresence {
namespace {
+const char kChromeVersion[] = "Chrome Version String";
+
void AddMessageWithStrategy(ReportRequest* report,
BroadcastScanConfiguration strategy) {
report->mutable_manage_messages_request()->add_message_to_publish()
@@ -83,7 +85,7 @@ class FakeDirectiveHandler : public DirectiveHandler {
class RpcHandlerTest : public testing::Test, public CopresenceClientDelegate {
public:
- RpcHandlerTest() : rpc_handler_(this), status_(SUCCESS) {
+ RpcHandlerTest() : rpc_handler_(this), status_(SUCCESS), api_key_("API key") {
rpc_handler_.server_post_callback_ =
base::Bind(&RpcHandlerTest::CaptureHttpPost, base::Unretained(this));
rpc_handler_.device_id_ = "Device ID";
@@ -168,7 +170,11 @@ class RpcHandlerTest : public testing::Test, public CopresenceClientDelegate {
}
virtual const std::string GetPlatformVersionString() const OVERRIDE {
- return "Version String";
+ return kChromeVersion;
+ }
+
+ virtual const std::string GetAPIKey() const OVERRIDE {
+ return api_key_;
}
virtual WhispernetClient* GetWhispernetClient() OVERRIDE {
@@ -180,10 +186,11 @@ class RpcHandlerTest : public testing::Test, public CopresenceClientDelegate {
base::MessageLoop message_loop_;
RpcHandler rpc_handler_;
+ CopresenceStatus status_;
+ std::string api_key_;
std::string rpc_name_;
scoped_ptr<MessageLite> request_proto_;
- CopresenceStatus status_;
std::map<std::string, std::vector<Message> > messages_by_subscription_;
};
@@ -287,11 +294,14 @@ TEST_F(RpcHandlerTest, CreateRequestHeader) {
StatusCallback());
EXPECT_EQ(RpcHandler::kReportRequestRpcName, rpc_name_);
ReportRequest* report = static_cast<ReportRequest*>(request_proto_.get());
- EXPECT_TRUE(report->header().has_framework_version());
+ EXPECT_EQ(kChromeVersion,
+ report->header().framework_version().version_name());
EXPECT_EQ("CreateRequestHeader App ID",
report->header().client_version().client());
EXPECT_EQ("CreateRequestHeader Device ID",
report->header().registered_device_id());
+ EXPECT_EQ(CHROME_PLATFORM_TYPE,
+ report->header().device_fingerprint().type());
}
// TODO(ckehoe): Renable these after https://codereview.chromium.org/453203002/
« no previous file with comments | « components/copresence/rpc/rpc_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698