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

Unified Diff: chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc

Issue 1131303002: Cleanup PushMessagingAppIdentifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_identifier
Patch Set: Undo accidental test change Created 5 years, 7 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
Index: chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc
diff --git a/chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc b/chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc
index ee22a00d298d1c0c69be30c8c06f0fa1054c9745..e79364d22d2b08bbb06beb12f30580f399cb1f57 100644
--- a/chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_app_identifier_unittest.cc
@@ -9,7 +9,7 @@ class PushMessagingAppIdentifierTest : public testing::Test {
protected:
PushMessagingAppIdentifier GenerateId(
const GURL& origin,
- int64 service_worker_registration_id) {
+ int64_t service_worker_registration_id) {
// To bypass DCHECK in PushMessagingAppIdentifier::Generate, we just use it
// to generate app_id, and then use private constructor.
std::string app_id = PushMessagingAppIdentifier::Generate(
@@ -20,13 +20,16 @@ class PushMessagingAppIdentifierTest : public testing::Test {
};
TEST_F(PushMessagingAppIdentifierTest, ConstructorValidity) {
- EXPECT_TRUE(GenerateId(GURL("https://www.example.com/"), 1).IsValid());
- EXPECT_TRUE(GenerateId(GURL("https://www.example.com"), 1).IsValid());
- EXPECT_FALSE(GenerateId(GURL(""), 1).IsValid());
- EXPECT_FALSE(GenerateId(GURL("foo"), 1).IsValid());
- EXPECT_FALSE(GenerateId(GURL("https://www.example.com/foo"), 1).IsValid());
- EXPECT_FALSE(GenerateId(GURL("https://www.example.com/#foo"), 1).IsValid());
- EXPECT_FALSE(GenerateId(GURL("https://www.example.com/"), -1).IsValid());
+ // The following two are valid:
+ EXPECT_FALSE(GenerateId(GURL("https://www.example.com/"), 1).is_null());
+ EXPECT_FALSE(GenerateId(GURL("https://www.example.com"), 1).is_null());
+ // The following four are invalid and will DCHECK in Generate:
+ EXPECT_FALSE(GenerateId(GURL(""), 1).is_null());
+ EXPECT_FALSE(GenerateId(GURL("foo"), 1).is_null());
+ EXPECT_FALSE(GenerateId(GURL("https://www.example.com/foo"), 1).is_null());
+ EXPECT_FALSE(GenerateId(GURL("https://www.example.com/#foo"), 1).is_null());
+ // The following one is invalid and will DCHECK in Generate and be null:
+ EXPECT_TRUE(GenerateId(GURL("https://www.example.com/"), -1).is_null());
}
TEST_F(PushMessagingAppIdentifierTest, UniqueGuids) {

Powered by Google App Engine
This is Rietveld 408576698