ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / services / gcm / push_messaging_application_id_unittest.cc
blob34944db55cf3fbad17d79179f625ea552df98130
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
3 // found in the LICENSE file.
5 #include "chrome/browser/services/gcm/push_messaging_application_id.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace gcm {
10 class PushMessagingApplicationIdTest : public testing::Test {
11 protected:
12 PushMessagingApplicationId GenerateId(
13 const GURL& origin,
14 int64 service_worker_registration_id) {
15 // To bypass DCHECK in PushMessagingApplicationId::Generate, we just use it
16 // to generate app_id_guid, and then use private constructor.
17 std::string app_id_guid = gcm::PushMessagingApplicationId::Generate(
18 GURL("https://www.example.com/"), 1).app_id_guid();
19 return PushMessagingApplicationId(app_id_guid, origin,
20 service_worker_registration_id);
24 TEST_F(PushMessagingApplicationIdTest, ConstructorValidity) {
25 EXPECT_TRUE(GenerateId(GURL("https://www.example.com/"), 1).IsValid());
26 EXPECT_TRUE(GenerateId(GURL("https://www.example.com"), 1).IsValid());
27 EXPECT_FALSE(GenerateId(GURL(""), 1).IsValid());
28 EXPECT_FALSE(GenerateId(GURL("foo"), 1).IsValid());
29 EXPECT_FALSE(GenerateId(GURL("https://www.example.com/foo"), 1).IsValid());
30 EXPECT_FALSE(GenerateId(GURL("https://www.example.com/#foo"), 1).IsValid());
31 EXPECT_FALSE(GenerateId(GURL("https://www.example.com/"), -1).IsValid());
34 TEST_F(PushMessagingApplicationIdTest, UniqueGuids) {
35 EXPECT_NE(gcm::PushMessagingApplicationId::Generate(
36 GURL("https://www.example.com/"), 1).app_id_guid(),
37 gcm::PushMessagingApplicationId::Generate(
38 GURL("https://www.example.com/"), 1).app_id_guid());
41 } // namespace gcm