| 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 }, | 1080 }, |
| 1081 }; | 1081 }; |
| 1082 | 1082 |
| 1083 // This test assumes that the danger level of .html files is | 1083 // This test assumes that the danger level of .html files is |
| 1084 // ALLOW_ON_USER_GESTURE. | 1084 // ALLOW_ON_USER_GESTURE. |
| 1085 ASSERT_EQ(download_util::ALLOW_ON_USER_GESTURE, | 1085 ASSERT_EQ(download_util::ALLOW_ON_USER_GESTURE, |
| 1086 download_util::GetFileDangerLevel( | 1086 download_util::GetFileDangerLevel( |
| 1087 base::FilePath(FILE_PATH_LITERAL("foo.html")))); | 1087 base::FilePath(FILE_PATH_LITERAL("foo.html")))); |
| 1088 | 1088 |
| 1089 // First the history service must exist. | 1089 // First the history service must exist. |
| 1090 profile()->CreateHistoryService(false, false); | 1090 ASSERT_TRUE(profile()->CreateHistoryService(false, false)); |
| 1091 | 1091 |
| 1092 GURL url("http://visited.example.com/visited-link.html"); | 1092 GURL url("http://visited.example.com/visited-link.html"); |
| 1093 // The time of visit is picked to be several seconds prior to the most recent | 1093 // The time of visit is picked to be several seconds prior to the most recent |
| 1094 // midnight. | 1094 // midnight. |
| 1095 base::Time time_of_visit( | 1095 base::Time time_of_visit( |
| 1096 base::Time::Now().LocalMidnight() - base::TimeDelta::FromSeconds(10)); | 1096 base::Time::Now().LocalMidnight() - base::TimeDelta::FromSeconds(10)); |
| 1097 HistoryService* history_service = | 1097 HistoryService* history_service = |
| 1098 HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); | 1098 HistoryServiceFactory::GetForProfile(profile(), Profile::EXPLICIT_ACCESS); |
| 1099 ASSERT_TRUE(history_service); | 1099 ASSERT_TRUE(history_service); |
| 1100 history_service->AddPage(url, time_of_visit, history::SOURCE_BROWSED); | 1100 history_service->AddPage(url, time_of_visit, history::SOURCE_BROWSED); |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 GetPathInDownloadDir(kInitialPath), | 1871 GetPathInDownloadDir(kInitialPath), |
| 1872 download_prefs(), | 1872 download_prefs(), |
| 1873 delegate(), | 1873 delegate(), |
| 1874 test_callback); | 1874 test_callback); |
| 1875 run_loop.Run(); | 1875 run_loop.Run(); |
| 1876 ::testing::Mock::VerifyAndClearExpectations(delegate()); | 1876 ::testing::Mock::VerifyAndClearExpectations(delegate()); |
| 1877 } | 1877 } |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 } // namespace | 1880 } // namespace |
| OLD | NEW |