| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "base/strings/stringprintf.h" | |
| 6 #include "chrome/browser/omaha_client/chrome_omaha_query_params_delegate.h" | |
| 7 #include "chrome/common/chrome_version_info.h" | |
| 8 #include "components/omaha_client/omaha_query_params.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 | |
| 11 using base::StringPrintf; | |
| 12 | |
| 13 namespace { | |
| 14 | |
| 15 bool Contains(const std::string& source, const std::string& target) { | |
| 16 return source.find(target) != std::string::npos; | |
| 17 } | |
| 18 | |
| 19 } // namespace | |
| 20 | |
| 21 void TestParams(omaha_client::OmahaQueryParams::ProdId prod_id) { | |
| 22 std::string params = omaha_client::OmahaQueryParams::Get(prod_id); | |
| 23 | |
| 24 EXPECT_TRUE(Contains( | |
| 25 params, | |
| 26 StringPrintf("os=%s", omaha_client::OmahaQueryParams::GetOS()))); | |
| 27 EXPECT_TRUE( | |
| 28 Contains(params, | |
| 29 StringPrintf("arch=%s", | |
| 30 omaha_client::OmahaQueryParams::GetArch()))); | |
| 31 EXPECT_TRUE(Contains( | |
| 32 params, | |
| 33 StringPrintf( | |
| 34 "prod=%s", | |
| 35 omaha_client::OmahaQueryParams::GetProdIdString(prod_id)))); | |
| 36 EXPECT_TRUE(Contains( | |
| 37 params, | |
| 38 StringPrintf("prodchannel=%s", | |
| 39 ChromeOmahaQueryParamsDelegate::GetChannelString()))); | |
| 40 EXPECT_TRUE(Contains( | |
| 41 params, | |
| 42 StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str()))); | |
| 43 EXPECT_TRUE(Contains( | |
| 44 params, | |
| 45 StringPrintf("lang=%s", ChromeOmahaQueryParamsDelegate::GetLang()))); | |
| 46 } | |
| 47 | |
| 48 TEST(ChromeOmahaQueryParamsDelegateTest, GetParams) { | |
| 49 TestParams(omaha_client::OmahaQueryParams::CRX); | |
| 50 TestParams(omaha_client::OmahaQueryParams::CHROME); | |
| 51 } | |
| OLD | NEW |