OLD | NEW |
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/data_use_tab_model.h" | 5 #include "chrome/browser/android/data_usage/data_use_tab_model.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 protected: | 73 protected: |
74 void SetUp() override { | 74 void SetUp() override { |
75 base::RunLoop().RunUntilIdle(); | 75 base::RunLoop().RunUntilIdle(); |
76 data_use_tab_model_.reset(new DataUseTabModel()); | 76 data_use_tab_model_.reset(new DataUseTabModel()); |
77 data_use_tab_model_->InitOnUIThread( | 77 data_use_tab_model_->InitOnUIThread( |
78 content::BrowserThread::GetMessageLoopProxyForThread( | 78 content::BrowserThread::GetMessageLoopProxyForThread( |
79 content::BrowserThread::IO), | 79 content::BrowserThread::IO), |
80 base::WeakPtr<ExternalDataUseObserver>()); | 80 base::WeakPtr<ExternalDataUseObserver>()); |
81 | 81 |
82 tick_clock_ = new base::SimpleTestTickClock(); | 82 // Start at a non nil time. |
83 | 83 tick_clock_ = new base::SimpleTestTickClock( |
84 // Advance to non nil time. | 84 base::TimeTicks() + base::TimeDelta::FromSeconds(1)); |
85 tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); | |
86 | 85 |
87 // |tick_clock_| will be owned by |data_use_tab_model_|. | 86 // |tick_clock_| will be owned by |data_use_tab_model_|. |
88 data_use_tab_model_->tick_clock_.reset(tick_clock_); | 87 data_use_tab_model_->tick_clock_.reset(tick_clock_); |
89 } | 88 } |
90 | 89 |
91 // Returns true if tab entry for |tab_id| exists in |active_tabs_|. | 90 // Returns true if tab entry for |tab_id| exists in |active_tabs_|. |
92 bool IsTabEntryExists(SessionID::id_type tab_id) const { | 91 bool IsTabEntryExists(SessionID::id_type tab_id) const { |
93 return data_use_tab_model_->active_tabs_.find(tab_id) != | 92 return data_use_tab_model_->active_tabs_.find(tab_id) != |
94 data_use_tab_model_->active_tabs_.end(); | 93 data_use_tab_model_->active_tabs_.end(); |
95 } | 94 } |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 labels.push_back("label_4"); | 797 labels.push_back("label_4"); |
799 labels.push_back("label_5"); | 798 labels.push_back("label_5"); |
800 RegisterURLRegexes(std::vector<std::string>(labels.size(), std::string()), | 799 RegisterURLRegexes(std::vector<std::string>(labels.size(), std::string()), |
801 std::vector<std::string>(labels.size(), kURLFoo), labels); | 800 std::vector<std::string>(labels.size(), kURLFoo), labels); |
802 EXPECT_FALSE(IsTrackingDataUse(kTabID1)); | 801 EXPECT_FALSE(IsTrackingDataUse(kTabID1)); |
803 } | 802 } |
804 | 803 |
805 } // namespace android | 804 } // namespace android |
806 | 805 |
807 } // namespace chrome | 806 } // namespace chrome |
OLD | NEW |