OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "net/extras/sqlite/sqlite_channel_id_store.h" | 5 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // linux, so we use the raw value here. | 77 // linux, so we use the raw value here. |
78 base::Time::Exploded exploded_time; | 78 base::Time::Exploded exploded_time; |
79 exploded_time.year = 2016; | 79 exploded_time.year = 2016; |
80 exploded_time.month = 5; | 80 exploded_time.month = 5; |
81 exploded_time.day_of_week = 0; // Unused. | 81 exploded_time.day_of_week = 0; // Unused. |
82 exploded_time.day_of_month = 7; | 82 exploded_time.day_of_month = 7; |
83 exploded_time.hour = 2; | 83 exploded_time.hour = 2; |
84 exploded_time.minute = 22; | 84 exploded_time.minute = 22; |
85 exploded_time.second = 39; | 85 exploded_time.second = 39; |
86 exploded_time.millisecond = 0; | 86 exploded_time.millisecond = 0; |
87 return base::Time::FromUTCExploded(exploded_time); | 87 base::Time out_time; |
| 88 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &out_time)); |
| 89 return out_time; |
88 } | 90 } |
89 | 91 |
90 static base::Time GetTestCertCreationTime() { | 92 static base::Time GetTestCertCreationTime() { |
91 // UTCTIME :150508022239Z | 93 // UTCTIME :150508022239Z |
92 base::Time::Exploded exploded_time; | 94 base::Time::Exploded exploded_time; |
93 exploded_time.year = 2015; | 95 exploded_time.year = 2015; |
94 exploded_time.month = 5; | 96 exploded_time.month = 5; |
95 exploded_time.day_of_week = 0; // Unused. | 97 exploded_time.day_of_week = 0; // Unused. |
96 exploded_time.day_of_month = 8; | 98 exploded_time.day_of_month = 8; |
97 exploded_time.hour = 2; | 99 exploded_time.hour = 2; |
98 exploded_time.minute = 22; | 100 exploded_time.minute = 22; |
99 exploded_time.second = 39; | 101 exploded_time.second = 39; |
100 exploded_time.millisecond = 0; | 102 exploded_time.millisecond = 0; |
101 return base::Time::FromUTCExploded(exploded_time); | 103 base::Time out_time; |
| 104 EXPECT_TRUE(base::Time::FromUTCExploded(exploded_time, &out_time)); |
| 105 return out_time; |
102 } | 106 } |
103 | 107 |
104 void SetUp() override { | 108 void SetUp() override { |
105 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
106 store_ = new SQLiteChannelIDStore( | 110 store_ = new SQLiteChannelIDStore( |
107 temp_dir_.GetPath().Append(kTestChannelIDFilename), | 111 temp_dir_.GetPath().Append(kTestChannelIDFilename), |
108 base::ThreadTaskRunnerHandle::Get()); | 112 base::ThreadTaskRunnerHandle::Get()); |
109 std::vector<std::unique_ptr<DefaultChannelIDStore::ChannelID>> channel_ids; | 113 std::vector<std::unique_ptr<DefaultChannelIDStore::ChannelID>> channel_ids; |
110 Load(&channel_ids); | 114 Load(&channel_ids); |
111 ASSERT_EQ(0u, channel_ids.size()); | 115 ASSERT_EQ(0u, channel_ids.size()); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 sql::Statement smt(db.GetUniqueStatement( | 536 sql::Statement smt(db.GetUniqueStatement( |
533 "SELECT value FROM meta WHERE key = \"version\"")); | 537 "SELECT value FROM meta WHERE key = \"version\"")); |
534 ASSERT_TRUE(smt.Step()); | 538 ASSERT_TRUE(smt.Step()); |
535 EXPECT_EQ(5, smt.ColumnInt(0)); | 539 EXPECT_EQ(5, smt.ColumnInt(0)); |
536 EXPECT_FALSE(smt.Step()); | 540 EXPECT_FALSE(smt.Step()); |
537 } | 541 } |
538 } | 542 } |
539 } | 543 } |
540 | 544 |
541 } // namespace net | 545 } // namespace net |
OLD | NEW |