| 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 "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 promo_test.InitPromoFromJson(true); | 522 promo_test.InitPromoFromJson(true); |
| 523 // Second time should not trigger a notification. | 523 // Second time should not trigger a notification. |
| 524 promo_test.InitPromoFromJson(false); | 524 promo_test.InitPromoFromJson(false); |
| 525 promo_test.TestInitFromPrefs(); | 525 promo_test.TestInitFromPrefs(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { | 528 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { |
| 529 GURL promo_server_url = NotificationPromo::PromoServerURL(); | 529 GURL promo_server_url = NotificationPromo::PromoServerURL(); |
| 530 EXPECT_FALSE(promo_server_url.is_empty()); | 530 EXPECT_FALSE(promo_server_url.is_empty()); |
| 531 EXPECT_TRUE(promo_server_url.is_valid()); | 531 EXPECT_TRUE(promo_server_url.is_valid()); |
| 532 EXPECT_TRUE(promo_server_url.SchemeIs(content::kHttpsScheme)); | 532 EXPECT_TRUE(promo_server_url.SchemeIs(url::kHttpsScheme)); |
| 533 // TODO(achuith): Test this better. | 533 // TODO(achuith): Test this better. |
| 534 } | 534 } |
| 535 | 535 |
| 536 #if defined(ENABLE_APP_LIST) | 536 #if defined(ENABLE_APP_LIST) |
| 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. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 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(prefs::kAppLauncherIsEnabled, true); | 579 local_state_.Get()->SetBoolean(prefs::kAppLauncherIsEnabled, true); |
| 580 EXPECT_FALSE(promo_test.promo().CanShow()); | 580 EXPECT_FALSE(promo_test.promo().CanShow()); |
| 581 } | 581 } |
| 582 #endif | 582 #endif |
| OLD | NEW |