Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/update_client/chrome_update_query_params_delegate_unittest.cc

Issue 1281913002: Componentize ComponentUpdaterConfigurator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS compile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h" 8 #include "chrome/browser/update_client/chrome_update_query_params_delegate.h"
9 #include "chrome/common/channel_info.h"
9 #include "components/update_client/update_query_params.h" 10 #include "components/update_client/update_query_params.h"
10 #include "components/version_info/version_info.h" 11 #include "components/version_info/version_info.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 using base::StringPrintf; 14 using base::StringPrintf;
14 15
15 namespace { 16 namespace {
16 17
17 bool Contains(const std::string& source, const std::string& target) { 18 bool Contains(const std::string& source, const std::string& target) {
18 return source.find(target) != std::string::npos; 19 return source.find(target) != std::string::npos;
19 } 20 }
20 21
21 } // namespace 22 } // namespace
22 23
23 void TestParams(update_client::UpdateQueryParams::ProdId prod_id) { 24 void TestParams(update_client::UpdateQueryParams::ProdId prod_id) {
24 std::string params = update_client::UpdateQueryParams::Get(prod_id); 25 std::string params = update_client::UpdateQueryParams::Get(prod_id);
25 26
26 EXPECT_TRUE(Contains( 27 EXPECT_TRUE(Contains(
27 params, 28 params,
28 StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS()))); 29 StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS())));
29 EXPECT_TRUE(Contains( 30 EXPECT_TRUE(Contains(
30 params, 31 params,
31 StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch()))); 32 StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch())));
32 EXPECT_TRUE(Contains( 33 EXPECT_TRUE(Contains(
33 params, StringPrintf( 34 params, StringPrintf(
34 "prod=%s", 35 "prod=%s",
35 update_client::UpdateQueryParams::GetProdIdString(prod_id)))); 36 update_client::UpdateQueryParams::GetProdIdString(prod_id))));
36 EXPECT_TRUE(Contains( 37 EXPECT_TRUE(Contains(
37 params, 38 params,
38 StringPrintf("prodchannel=%s", 39 StringPrintf("prodchannel=%s", chrome::GetChannelString().c_str())));
39 ChromeUpdateQueryParamsDelegate::GetChannelString())));
40 EXPECT_TRUE( 40 EXPECT_TRUE(
41 Contains(params, StringPrintf("prodversion=%s", 41 Contains(params, StringPrintf("prodversion=%s",
42 version_info::GetVersionNumber().c_str()))); 42 version_info::GetVersionNumber().c_str())));
43 EXPECT_TRUE(Contains( 43 EXPECT_TRUE(Contains(
44 params, 44 params,
45 StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang()))); 45 StringPrintf("lang=%s", ChromeUpdateQueryParamsDelegate::GetLang())));
46 } 46 }
47 47
48 TEST(ChromeUpdateQueryParamsDelegateTest, GetParams) { 48 TEST(ChromeUpdateQueryParamsDelegateTest, GetParams) {
49 TestParams(update_client::UpdateQueryParams::CRX); 49 TestParams(update_client::UpdateQueryParams::CRX);
50 TestParams(update_client::UpdateQueryParams::CHROME); 50 TestParams(update_client::UpdateQueryParams::CHROME);
51 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698