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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 1231613005: Hook up the Push API with GCM's new ability to own encryption keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-encryption
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/barrier_closure.h" 8 #include "base/barrier_closure.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 1087
1088 run_loop.Run(); 1088 run_loop.Run();
1089 1089
1090 // |app_identifier| should no longer be stored in prefs. 1090 // |app_identifier| should no longer be stored in prefs.
1091 PushMessagingAppIdentifier stored_app_identifier2 = 1091 PushMessagingAppIdentifier stored_app_identifier2 =
1092 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(), 1092 PushMessagingAppIdentifier::FindByAppId(GetBrowser()->profile(),
1093 app_identifier.app_id()); 1093 app_identifier.app_id());
1094 EXPECT_TRUE(stored_app_identifier2.is_null()); 1094 EXPECT_TRUE(stored_app_identifier2.is_null());
1095 } 1095 }
1096 1096
1097 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, EncryptionKeyUniqueness) {
1098 TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */);
1099
1100 std::string first_public_key;
1101 ASSERT_TRUE(RunScript("getCurve25519dh()", &first_public_key));
1102 EXPECT_GE(first_public_key.size(), 32u);
1103
1104 std::string script_result;
1105 gcm_service()->AddExpectedUnregisterResponse(gcm::GCMClient::SUCCESS);
1106 ASSERT_TRUE(RunScript("unsubscribePush()", &script_result));
1107 EXPECT_EQ("unsubscribe result: true", script_result);
1108
1109 TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
1110
1111 std::string second_public_key;
1112 ASSERT_TRUE(RunScript("getCurve25519dh()", &second_public_key));
1113 EXPECT_GE(second_public_key.size(), 32u);
1114
1115 EXPECT_NE(first_public_key, second_public_key);
1116 }
1117
1097 class PushMessagingIncognitoBrowserTest : public PushMessagingBrowserTest { 1118 class PushMessagingIncognitoBrowserTest : public PushMessagingBrowserTest {
1098 public: 1119 public:
1099 ~PushMessagingIncognitoBrowserTest() override {} 1120 ~PushMessagingIncognitoBrowserTest() override {}
1100 1121
1101 // PushMessagingBrowserTest: 1122 // PushMessagingBrowserTest:
1102 void SetUpOnMainThread() override { 1123 void SetUpOnMainThread() override {
1103 incognito_browser_ = CreateIncognitoBrowser(); 1124 incognito_browser_ = CreateIncognitoBrowser();
1104 PushMessagingBrowserTest::SetUpOnMainThread(); 1125 PushMessagingBrowserTest::SetUpOnMainThread();
1105 } 1126 }
1106 1127
(...skipping 11 matching lines...) Expand all
1118 std::string script_result; 1139 std::string script_result;
1119 1140
1120 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 1141 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
1121 ASSERT_EQ("ok - service worker registered", script_result); 1142 ASSERT_EQ("ok - service worker registered", script_result);
1122 1143
1123 // In Incognito mode the promise returned by getSubscription should not hang, 1144 // In Incognito mode the promise returned by getSubscription should not hang,
1124 // it should just fulfill with null. 1145 // it should just fulfill with null.
1125 ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); 1146 ASSERT_TRUE(RunScript("hasSubscription()", &script_result));
1126 ASSERT_EQ("false - not subscribed", script_result); 1147 ASSERT_EQ("false - not subscribed", script_result);
1127 } 1148 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698