Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/browser/android/data_usage/tab_data_use_entry_unittest.cc

Issue 2624663002: Changed uses of deque to vector in chrome/browser/android/data_usage. (Closed)
Patch Set: fix bad math Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/data_usage/tab_data_use_entry.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/android/data_usage/tab_data_use_entry.h" 5 #include "chrome/browser/android/data_usage/tab_data_use_entry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Pointer to the clock used for spoofing time, owned by |tab_model_|. 156 // Pointer to the clock used for spoofing time, owned by |tab_model_|.
157 SimpleOffsetTestTickClock* tick_clock_; 157 SimpleOffsetTestTickClock* tick_clock_;
158 158
159 std::unique_ptr<DataUseTabModel> tab_model_; 159 std::unique_ptr<DataUseTabModel> tab_model_;
160 std::unique_ptr<TabDataUseEntry> tab_entry_; 160 std::unique_ptr<TabDataUseEntry> tab_entry_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(TabDataUseEntryTest); 162 DISALLOW_COPY_AND_ASSIGN(TabDataUseEntryTest);
163 }; 163 };
164 164
165 // Starts a single tracking session and checks if a new active session is added 165 // Starts a single tracking session and checks if a new active session is added
166 // to the deque. Ends the session and checks if it becomes inactive. 166 // to the vector. Ends the session and checks if it becomes inactive.
167 TEST_F(TabDataUseEntryTest, SingleTabSessionStartEnd) { 167 TEST_F(TabDataUseEntryTest, SingleTabSessionStartEnd) {
168 ExpectTabEntrySessionsSize(TabEntrySessionSize::ZERO); 168 ExpectTabEntrySessionsSize(TabEntrySessionSize::ZERO);
169 EXPECT_FALSE(tab_entry_->IsTrackingDataUse()); 169 EXPECT_FALSE(tab_entry_->IsTrackingDataUse());
170 170
171 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel1)); 171 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel1));
172 ExpectTabEntrySessionsSize(TabEntrySessionSize::ONE); 172 ExpectTabEntrySessionsSize(TabEntrySessionSize::ONE);
173 EXPECT_TRUE(tab_entry_->IsTrackingDataUse()); 173 EXPECT_TRUE(tab_entry_->IsTrackingDataUse());
174 174
175 EXPECT_TRUE(tab_entry_->EndTracking()); 175 EXPECT_TRUE(tab_entry_->EndTracking());
176 ExpectTabEntrySessionsSize(TabEntrySessionSize::ONE); 176 ExpectTabEntrySessionsSize(TabEntrySessionSize::ONE);
177 EXPECT_FALSE(tab_entry_->IsTrackingDataUse()); 177 EXPECT_FALSE(tab_entry_->IsTrackingDataUse());
178 } 178 }
179 179
180 // Starts multiple tracking sessions and checks if new active sessions are added 180 // Starts multiple tracking sessions and checks if new active sessions are added
181 // to the deque for each. Ends the sessions and checks if they become inactive. 181 // to the vector for each. Ends the sessions and checks if they become inactive.
182 TEST_F(TabDataUseEntryTest, MultipleTabSessionStartEnd) { 182 TEST_F(TabDataUseEntryTest, MultipleTabSessionStartEnd) {
183 ExpectTabEntrySessionsSize(TabEntrySessionSize::ZERO); 183 ExpectTabEntrySessionsSize(TabEntrySessionSize::ZERO);
184 EXPECT_FALSE(tab_entry_->IsTrackingDataUse()); 184 EXPECT_FALSE(tab_entry_->IsTrackingDataUse());
185 185
186 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel1)); 186 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel1));
187 EXPECT_TRUE(tab_entry_->IsTrackingDataUse()); 187 EXPECT_TRUE(tab_entry_->IsTrackingDataUse());
188 EXPECT_TRUE(tab_entry_->EndTracking()); 188 EXPECT_TRUE(tab_entry_->EndTracking());
189 EXPECT_FALSE(tab_entry_->IsTrackingDataUse()); 189 EXPECT_FALSE(tab_entry_->IsTrackingDataUse());
190 190
191 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel2)); 191 EXPECT_TRUE(tab_entry_->StartTracking(kTestLabel2));
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 EXPECT_TRUE(tab_entry_->EndTracking()); 550 EXPECT_TRUE(tab_entry_->EndTracking());
551 551
552 histogram_tester.ExpectUniqueSample( 552 histogram_tester.ExpectUniqueSample(
553 kUMAOldInactiveSessionRemovalDurationSecondsHistogram, 553 kUMAOldInactiveSessionRemovalDurationSecondsHistogram,
554 base::TimeDelta::FromSeconds(30).InMilliseconds(), 1); 554 base::TimeDelta::FromSeconds(30).InMilliseconds(), 1);
555 } 555 }
556 556
557 } // namespace android 557 } // namespace android
558 558
559 } // namespace chrome 559 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/android/data_usage/tab_data_use_entry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698