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.
7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
9 #include "chrome/common/chrome_version_info.h"
10 #include "components/update_client/update_query_params.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using base::StringPrintf
;
17 bool Contains(const std::string
& source
, const std::string
& target
) {
18 return source
.find(target
) != std::string::npos
;
23 void TestParams(update_client::UpdateQueryParams::ProdId prod_id
) {
24 std::string params
= update_client::UpdateQueryParams::Get(prod_id
);
28 StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS())));
31 StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch())));
35 update_client::UpdateQueryParams::GetProdIdString(prod_id
))));
38 StringPrintf("prodchannel=%s",
39 ChromeUpdateQueryParamsDelegate::GetChannelString())));
42 StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str())));
45 StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang())));
48 TEST(ChromeUpdateQueryParamsDelegateTest
, GetParams
) {
49 TestParams(update_client::UpdateQueryParams::CRX
);
50 TestParams(update_client::UpdateQueryParams::CHROME
);