OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 5 #include <utility> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "apps/pref_names.h" | 8 #include "apps/pref_names.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 promo_test.InitPromoFromJson(true); | 523 promo_test.InitPromoFromJson(true); |
524 // Second time should not trigger a notification. | 524 // Second time should not trigger a notification. |
525 promo_test.InitPromoFromJson(false); | 525 promo_test.InitPromoFromJson(false); |
526 promo_test.TestInitFromPrefs(); | 526 promo_test.TestInitFromPrefs(); |
527 } | 527 } |
528 | 528 |
529 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { | 529 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { |
530 GURL promo_server_url = NotificationPromo::PromoServerURL(); | 530 GURL promo_server_url = NotificationPromo::PromoServerURL(); |
531 EXPECT_FALSE(promo_server_url.is_empty()); | 531 EXPECT_FALSE(promo_server_url.is_empty()); |
532 EXPECT_TRUE(promo_server_url.is_valid()); | 532 EXPECT_TRUE(promo_server_url.is_valid()); |
533 EXPECT_TRUE(promo_server_url.SchemeIs(chrome::kHttpsScheme)); | 533 EXPECT_TRUE(promo_server_url.SchemeIs(content::kHttpsScheme)); |
534 // TODO(achuith): Test this better. | 534 // TODO(achuith): Test this better. |
535 } | 535 } |
536 | 536 |
537 TEST_F(PromoResourceServiceTest, AppLauncherPromoTest) { | 537 TEST_F(PromoResourceServiceTest, AppLauncherPromoTest) { |
538 // Check that prefs are set correctly. | 538 // Check that prefs are set correctly. |
539 NotificationPromoTest promo_test; | 539 NotificationPromoTest promo_test; |
540 | 540 |
541 // Set up start date and promo line in a Dictionary as if parsed from the | 541 // Set up start date and promo line in a Dictionary as if parsed from the |
542 // service. date[0].end is replaced with a date 1 year in the future. | 542 // service. date[0].end is replaced with a date 1 year in the future. |
543 promo_test.Init("{" | 543 promo_test.Init("{" |
(...skipping 28 matching lines...) Expand all Loading... |
572 "}", | 572 "}", |
573 "What do you think of Chrome?", | 573 "What do you think of Chrome?", |
574 // The starting date is in 1999 to make tests pass | 574 // The starting date is in 1999 to make tests pass |
575 // on Android devices with incorrect or unset date/time. | 575 // on Android devices with incorrect or unset date/time. |
576 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. | 576 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. |
577 1000, 200, 100, 3600, 400, 30); | 577 1000, 200, 100, 3600, 400, 30); |
578 promo_test.InitPromoFromJson(true); | 578 promo_test.InitPromoFromJson(true); |
579 local_state_.Get()->SetBoolean(apps::prefs::kAppLauncherIsEnabled, true); | 579 local_state_.Get()->SetBoolean(apps::prefs::kAppLauncherIsEnabled, true); |
580 EXPECT_FALSE(promo_test.promo().CanShow()); | 580 EXPECT_FALSE(promo_test.promo().CanShow()); |
581 } | 581 } |
OLD | NEW |