summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/components_tests.gyp6
-rw-r--r--components/cronet/DEPS1
-rw-r--r--components/cronet/android/cronet_histogram_manager.cc4
-rw-r--r--components/cronet/cronet_static.gypi2
-rw-r--r--components/cronet/histogram_manager.cc (renamed from components/metrics/histogram_manager.cc)6
-rw-r--r--components/cronet/histogram_manager.h (renamed from components/metrics/histogram_manager.h)19
-rw-r--r--components/cronet/histogram_manager_unittest.cc (renamed from components/metrics/histogram_manager_unittest.cc)16
-rw-r--r--components/metrics.gypi2
-rw-r--r--components/metrics/BUILD.gn3
9 files changed, 30 insertions, 29 deletions
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 110f7ec..a4114e8 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -175,6 +175,9 @@
'copresence/rpc/rpc_handler_unittest.cc',
'copresence/timed_map_unittest.cc',
],
+ 'cronet_unittest_sources': [
+ 'cronet/histogram_manager_unittest.cc',
+ ],
'enhanced_bookmarks_unittest_sources': [
'enhanced_bookmarks/enhanced_bookmark_model_unittest.cc',
'enhanced_bookmarks/image_store_ios_unittest.mm',
@@ -255,7 +258,6 @@
'metrics/daily_event_unittest.cc',
'metrics/gpu/gpu_metrics_provider_unittest.cc',
'metrics/histogram_encoder_unittest.cc',
- 'metrics/histogram_manager_unittest.cc',
'metrics/machine_id_provider_win_unittest.cc',
'metrics/metrics_hashes_unittest.cc',
'metrics/metrics_log_manager_unittest.cc',
@@ -880,6 +882,7 @@
}],
['OS == "android"', {
'sources': [
+ '<@(cronet_unittest_sources)',
'data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc',
'data_reduction_proxy/content/browser/data_reduction_proxy_debug_resource_throttle_unittest.cc',
'data_reduction_proxy/content/browser/data_reduction_proxy_debug_ui_manager_unittest.cc',
@@ -901,6 +904,7 @@
'web_modal/web_contents_modal_dialog_manager_unittest.cc',
],
'dependencies': [
+ 'components.gyp:cronet_static',
'components.gyp:data_reduction_proxy_content',
'../testing/android/native_test.gyp:native_test_native_code',
],
diff --git a/components/cronet/DEPS b/components/cronet/DEPS
index 8fa9d48..413c4b4 100644
--- a/components/cronet/DEPS
+++ b/components/cronet/DEPS
@@ -1,3 +1,4 @@
include_rules = [
+ "+components/metrics",
"+net",
]
diff --git a/components/cronet/android/cronet_histogram_manager.cc b/components/cronet/android/cronet_histogram_manager.cc
index 8c30bbb..de1989b 100644
--- a/components/cronet/android/cronet_histogram_manager.cc
+++ b/components/cronet/android/cronet_histogram_manager.cc
@@ -9,7 +9,7 @@
#include "base/android/jni_array.h"
#include "base/metrics/statistics_recorder.h"
-#include "components/metrics/histogram_manager.h"
+#include "components/cronet/histogram_manager.h"
#include "jni/CronetHistogramManager_jni.h"
@@ -26,7 +26,7 @@ static void EnsureInitialized(JNIEnv* env, jobject jcaller) {
static jbyteArray GetHistogramDeltas(JNIEnv* env, jobject jcaller) {
std::vector<uint8> data;
- if (!metrics::HistogramManager::GetInstance()->GetDeltas(&data))
+ if (!HistogramManager::GetInstance()->GetDeltas(&data))
return NULL;
return base::android::ToJavaByteArray(env, &data[0], data.size()).Release();
}
diff --git a/components/cronet/cronet_static.gypi b/components/cronet/cronet_static.gypi
index e4d688a..9edf982 100644
--- a/components/cronet/cronet_static.gypi
+++ b/components/cronet/cronet_static.gypi
@@ -39,6 +39,8 @@
'android/url_request_context_adapter.h',
'android/wrapped_channel_upload_element_reader.cc',
'android/wrapped_channel_upload_element_reader.h',
+ 'histogram_manager.cc',
+ 'histogram_manager.h',
'url_request_context_config.cc',
'url_request_context_config.h',
'url_request_context_config_list.h',
diff --git a/components/metrics/histogram_manager.cc b/components/cronet/histogram_manager.cc
index dfa865b..afbb447 100644
--- a/components/metrics/histogram_manager.cc
+++ b/components/cronet/histogram_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/metrics/histogram_manager.h"
+#include "components/cronet/histogram_manager.h"
#include <string>
#include <vector>
@@ -12,7 +12,7 @@
#include "base/metrics/histogram_samples.h"
#include "components/metrics/histogram_encoder.h"
-namespace metrics {
+namespace cronet {
// TODO(rtenneti): move g_histogram_manager into java code.
static base::LazyInstance<HistogramManager>::Leaky
@@ -64,4 +64,4 @@ bool HistogramManager::GetDeltas(std::vector<uint8>* data) {
return false;
}
-} // namespace metrics
+} // namespace cronet
diff --git a/components/metrics/histogram_manager.h b/components/cronet/histogram_manager.h
index 7334ae3..ae4b249 100644
--- a/components/metrics/histogram_manager.h
+++ b/components/cronet/histogram_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_
-#define COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_
+#ifndef COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_
+#define COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_
#include <string>
#include <vector>
@@ -16,14 +16,11 @@
#include "base/metrics/histogram_snapshot_manager.h"
#include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
-namespace metrics {
+namespace cronet {
-// TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.*
-// files into components/android/cronet.
-//
-// A HistogramManager instance is created by Android. It is the central
-// controller for the acquisition of log data, and the automatic transmission of
-// that log data to an external server.
+// A HistogramManager instance is created by the app. It is the central
+// controller for the acquisition of log data, and recording deltas for
+// transmission to an external server.
class HistogramManager : public base::HistogramFlattener {
public:
HistogramManager();
@@ -57,6 +54,6 @@ class HistogramManager : public base::HistogramFlattener {
DISALLOW_COPY_AND_ASSIGN(HistogramManager);
};
-} // namespace metrics
+} // namespace cronet
-#endif // COMPONENTS_METRICS_HISTOGRAM_MANAGER_H_
+#endif // COMPONENTS_CRONET_HISTOGRAM_MANAGER_H_
diff --git a/components/metrics/histogram_manager_unittest.cc b/components/cronet/histogram_manager_unittest.cc
index 5e5f992..62f7b91 100644
--- a/components/metrics/histogram_manager_unittest.cc
+++ b/components/cronet/histogram_manager_unittest.cc
@@ -2,19 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/metrics/histogram_manager.h"
+#include "components/cronet/histogram_manager.h"
#include <string>
#include "base/basictypes.h"
+#include "base/metrics/statistics_recorder.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace metrics {
+namespace cronet {
-// TODO(mef): crbug.com/441441. Move components/metrics/histogram_manager.*
-// files into components/android/cronet.
-// TODO(rtenneti): enable flaky HistogramBucketFields unit test.
-TEST(HistogramManager, DISABLED_HistogramBucketFields) {
+using metrics::ChromeUserMetricsExtension;
+using metrics::HistogramEventProto;
+
+TEST(HistogramManager, HistogramBucketFields) {
+ base::StatisticsRecorder::Initialize();
// Capture histograms at the start of the test to avoid later GetDeltas()
// calls picking them up.
std::vector<uint8> data_init;
@@ -55,4 +57,4 @@ TEST(HistogramManager, DISABLED_HistogramBucketFields) {
EXPECT_EQ(1, histogram_proto2.bucket(0).count());
}
-} // namespace metrics
+} // namespace cronet
diff --git a/components/metrics.gypi b/components/metrics.gypi
index f0d3f41..ddad096 100644
--- a/components/metrics.gypi
+++ b/components/metrics.gypi
@@ -37,8 +37,6 @@
'metrics/daily_event.h',
'metrics/histogram_encoder.cc',
'metrics/histogram_encoder.h',
- 'metrics/histogram_manager.cc',
- 'metrics/histogram_manager.h',
'metrics/machine_id_provider.h',
'metrics/machine_id_provider_stub.cc',
'metrics/machine_id_provider_win.cc',
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn
index 8a3e0cc..1c7301c 100644
--- a/components/metrics/BUILD.gn
+++ b/components/metrics/BUILD.gn
@@ -19,8 +19,6 @@ source_set("metrics") {
"daily_event.h",
"histogram_encoder.cc",
"histogram_encoder.h",
- "histogram_manager.cc",
- "histogram_manager.h",
"machine_id_provider.h",
"machine_id_provider_stub.cc",
"machine_id_provider_win.cc",
@@ -172,7 +170,6 @@ source_set("unit_tests") {
"compression_utils_unittest.cc",
"daily_event_unittest.cc",
"histogram_encoder_unittest.cc",
- "histogram_manager_unittest.cc",
"machine_id_provider_win_unittest.cc",
"metrics_hashes_unittest.cc",
"metrics_log_manager_unittest.cc",