Commit db879ef8 authored by gunsch's avatar gunsch Committed by Commit bot

Chromecast: command-line switch to override the UMA metric upload URL.

R=byungchul@chromium.org,isherman@chromium.org
BUG=None

Review URL: https://codereview.chromium.org/506083003

Cr-Commit-Position: refs/heads/master@{#292791}
parent c0422d5a
......@@ -26,6 +26,8 @@
'common/cast_resource_delegate.h',
'common/chromecast_config.cc',
'common/chromecast_config.h',
'common/chromecast_switches.cc',
'common/chromecast_switches.h',
'common/pref_names.cc',
'common/pref_names.h',
],
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/common/chromecast_switches.h"
namespace switches {
// Override the URL to which metrics logs are sent for debugging.
const char kOverrideMetricsUploadUrl[] = "override-metrics-upload-url";
} // namespace switches
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_COMMON_CHROMECAST_SWITCHES_H_
#define CHROMECAST_COMMON_CHROMECAST_SWITCHES_H_
#include "build/build_config.h"
namespace switches {
// Metrics switches
extern const char kOverrideMetricsUploadUrl[];
} // namespace switches
#endif // CHROMECAST_COMMON_CHROMECAST_SWITCHES_H_
......@@ -4,8 +4,10 @@
#include "chromecast/metrics/cast_metrics_service_client.h"
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "chromecast/common/chromecast_config.h"
#include "chromecast/common/chromecast_switches.h"
#include "chromecast/metrics/platform_metrics_providers.h"
#include "components/metrics/client_info.h"
#include "components/metrics/metrics_provider.h"
......@@ -81,10 +83,17 @@ CastMetricsServiceClient::CreateUploader(
const std::string& server_url,
const std::string& mime_type,
const base::Callback<void(int)>& on_upload_complete) {
std::string uma_server_url(server_url);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) {
uma_server_url.assign(
command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl));
}
DCHECK(!uma_server_url.empty());
return scoped_ptr< ::metrics::MetricsLogUploader>(
new ::metrics::NetMetricsLogUploader(
request_context_,
server_url,
uma_server_url,
mime_type,
on_upload_complete));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment