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