Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / update_client / chrome_update_query_params_delegate_unittest.cc
blob0c47cba2bac8a33c42f5cede4403f083e7acd217
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 <string>
7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
9 #include "chrome/common/channel_info.h"
10 #include "components/update_client/update_query_params.h"
11 #include "components/version_info/version_info.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 using base::StringPrintf;
16 namespace {
18 bool Contains(const std::string& source, const std::string& target) {
19 return source.find(target) != std::string::npos;
22 } // namespace
24 void TestParams(update_client::UpdateQueryParams::ProdId prod_id) {
25 std::string params = update_client::UpdateQueryParams::Get(prod_id);
27 EXPECT_TRUE(Contains(
28 params,
29 StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS())));
30 EXPECT_TRUE(Contains(
31 params,
32 StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch())));
33 EXPECT_TRUE(Contains(
34 params, StringPrintf(
35 "prod=%s",
36 update_client::UpdateQueryParams::GetProdIdString(prod_id))));
37 EXPECT_TRUE(Contains(
38 params,
39 StringPrintf("prodchannel=%s", chrome::GetChannelString().c_str())));
40 EXPECT_TRUE(
41 Contains(params, StringPrintf("prodversion=%s",
42 version_info::GetVersionNumber().c_str())));
43 EXPECT_TRUE(Contains(
44 params,
45 StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang())));
48 TEST(ChromeUpdateQueryParamsDelegateTest, GetParams) {
49 TestParams(update_client::UpdateQueryParams::CRX);
50 TestParams(update_client::UpdateQueryParams::CHROME);