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.h" | 10 #include "base/message_loop.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/prefs/browser_prefs.h" | 19 #include "chrome/browser/prefs/browser_prefs.h" |
20 #include "chrome/browser/web_resource/notification_promo.h" | 20 #include "chrome/browser/web_resource/notification_promo.h" |
21 #include "chrome/browser/web_resource/promo_resource_service.h" | 21 #include "chrome/browser/web_resource/promo_resource_service.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "chrome/test/base/scoped_testing_local_state.h" | 24 #include "chrome/test/base/scoped_testing_local_state.h" |
25 #include "chrome/test/base/testing_browser_process.h" | 25 #include "chrome/test/base/testing_browser_process.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "net/url_request/test_url_fetcher_factory.h" | 28 #include "net/url_request/test_url_fetcher_factory.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "third_party/icu/public/i18n/unicode/smpdtfmt.h" | 30 #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const char kDateFormat[] = "dd MMM yyyy HH:mm:ss zzz"; | 34 const char kDateFormat[] = "dd MMM yyyy HH:mm:ss zzz"; |
35 | 35 |
36 bool YearFromNow(double* date_epoch, std::string* date_string) { | 36 bool YearFromNow(double* date_epoch, std::string* date_string) { |
37 *date_epoch = (base::Time::Now() + base::TimeDelta::FromDays(365)).ToTimeT(); | 37 *date_epoch = (base::Time::Now() + base::TimeDelta::FromDays(365)).ToTimeT(); |
38 | 38 |
39 UErrorCode status = U_ZERO_ERROR; | 39 UErrorCode status = U_ZERO_ERROR; |
40 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat), | 40 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat), |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |