1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/strings/stringprintf.h"
6 #include "chrome/browser/omaha_query_params/chrome_omaha_query_params_delegate.h"
7 #include "chrome/common/chrome_version_info.h"
8 #include "components/omaha_query_params/omaha_query_params.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 using base::StringPrintf
;
15 bool Contains(const std::string
& source
, const std::string
& target
) {
16 return source
.find(target
) != std::string::npos
;
21 void TestParams(omaha_query_params::OmahaQueryParams::ProdId prod_id
) {
22 std::string params
= omaha_query_params::OmahaQueryParams::Get(prod_id
);
26 StringPrintf("os=%s", omaha_query_params::OmahaQueryParams::GetOS())));
29 StringPrintf("arch=%s",
30 omaha_query_params::OmahaQueryParams::GetArch())));
35 omaha_query_params::OmahaQueryParams::GetProdIdString(prod_id
))));
38 StringPrintf("prodchannel=%s",
39 ChromeOmahaQueryParamsDelegate::GetChannelString())));
42 StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str())));
45 StringPrintf("lang=%s", ChromeOmahaQueryParamsDelegate::GetLang())));
48 TEST(ChromeOmahaQueryParamsDelegateTest
, GetParams
) {
49 TestParams(omaha_query_params::OmahaQueryParams::CRX
);
50 TestParams(omaha_query_params::OmahaQueryParams::CHROME
);