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/external_data_use_observer.h" | 5 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "components/data_usage/core/data_use.h" | 16 #include "components/data_usage/core/data_use.h" |
17 #include "components/data_usage/core/data_use_aggregator.h" | 17 #include "components/data_usage/core/data_use_aggregator.h" |
| 18 #include "components/data_usage/core/data_use_annotator.h" |
18 #include "components/variations/variations_associated_data.h" | 19 #include "components/variations/variations_associated_data.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
21 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace chrome { | 26 namespace chrome { |
26 | 27 |
27 namespace android { | 28 namespace android { |
28 | 29 |
29 class ExternalDataUseObserverTest : public testing::Test { | 30 class ExternalDataUseObserverTest : public testing::Test { |
30 public: | 31 public: |
31 void SetUp() override { | 32 void SetUp() override { |
32 thread_bundle_.reset(new content::TestBrowserThreadBundle( | 33 thread_bundle_.reset(new content::TestBrowserThreadBundle( |
33 content::TestBrowserThreadBundle::REAL_IO_THREAD)); | 34 content::TestBrowserThreadBundle::REAL_IO_THREAD)); |
34 io_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( | 35 io_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( |
35 content::BrowserThread::IO); | 36 content::BrowserThread::IO); |
36 ui_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( | 37 ui_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( |
37 content::BrowserThread::UI); | 38 content::BrowserThread::UI); |
38 data_use_aggregator_.reset(new data_usage::DataUseAggregator()); | 39 data_use_aggregator_.reset(new data_usage::DataUseAggregator( |
| 40 scoped_ptr<data_usage::DataUseAnnotator>())); |
39 external_data_use_observer_.reset(new ExternalDataUseObserver( | 41 external_data_use_observer_.reset(new ExternalDataUseObserver( |
40 data_use_aggregator_.get(), io_task_runner_.get(), | 42 data_use_aggregator_.get(), io_task_runner_.get(), |
41 ui_task_runner_.get())); | 43 ui_task_runner_.get())); |
42 } | 44 } |
43 | 45 |
44 scoped_ptr<ExternalDataUseObserver> Create() const { | 46 scoped_ptr<ExternalDataUseObserver> Create() const { |
45 return scoped_ptr<ExternalDataUseObserver>(new ExternalDataUseObserver( | 47 return scoped_ptr<ExternalDataUseObserver>(new ExternalDataUseObserver( |
46 data_use_aggregator_.get(), io_task_runner_.get(), | 48 data_use_aggregator_.get(), io_task_runner_.get(), |
47 ui_task_runner_.get())); | 49 ui_task_runner_.get())); |
48 } | 50 } |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 external_data_use_obsever_with_variations | 636 external_data_use_obsever_with_variations |
635 ->fetch_matching_rules_duration_); | 637 ->fetch_matching_rules_duration_); |
636 EXPECT_EQ( | 638 EXPECT_EQ( |
637 data_use_report_min_bytes, | 639 data_use_report_min_bytes, |
638 external_data_use_obsever_with_variations->data_use_report_min_bytes_); | 640 external_data_use_obsever_with_variations->data_use_report_min_bytes_); |
639 } | 641 } |
640 | 642 |
641 } // namespace android | 643 } // namespace android |
642 | 644 |
643 } // namespace chrome | 645 } // namespace chrome |
OLD | NEW |