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

Side by Side Diff: components/update_client/update_query_params_unittest.cc

Issue 803313003: Rename omaha_client and similar tokens to update_client in all contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: rebase to master Created 5 years, 11 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
« no previous file with comments | « components/update_client/update_query_params_delegate.cc ('k') | extensions/browser/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "components/update_client/update_query_params.h"
7 #include "components/update_client/update_query_params_delegate.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 using base::StringPrintf;
11
12 namespace update_client {
13
14 namespace {
15
16 bool Contains(const std::string& source, const std::string& target) {
17 return source.find(target) != std::string::npos;
18 }
19
20 class TestUpdateQueryParamsDelegate : public UpdateQueryParamsDelegate {
21 std::string GetExtraParams() override { return "&cat=dog"; }
22 };
23
24 } // namespace
25
26 void TestParams(UpdateQueryParams::ProdId prod_id, bool extra_params) {
27 std::string params = UpdateQueryParams::Get(prod_id);
28
29 // This doesn't so much test what the values are (since that would be an
30 // almost exact duplication of code with update_query_params.cc, and wouldn't
31 // really test anything) as it is a verification that all the params are
32 // present in the generated string.
33 EXPECT_TRUE(
34 Contains(params, StringPrintf("os=%s", UpdateQueryParams::GetOS())));
35 EXPECT_TRUE(
36 Contains(params, StringPrintf("arch=%s", UpdateQueryParams::GetArch())));
37 EXPECT_TRUE(Contains(
38 params,
39 StringPrintf("prod=%s", UpdateQueryParams::GetProdIdString(prod_id))));
40 if (extra_params)
41 EXPECT_TRUE(Contains(params, "cat=dog"));
42 }
43
44 TEST(UpdateQueryParamsTest, GetParams) {
45 TestParams(UpdateQueryParams::CRX, false);
46 TestParams(UpdateQueryParams::CHROME, false);
47
48 TestUpdateQueryParamsDelegate delegate;
49 UpdateQueryParams::SetDelegate(&delegate);
50
51 TestParams(UpdateQueryParams::CRX, true);
52 TestParams(UpdateQueryParams::CHROME, true);
53 }
54
55 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/update_query_params_delegate.cc ('k') | extensions/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698