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

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

Issue 2768573002: Send traffic-management headers from extension updater. (Closed)
Patch Set: Change the code according to mek's comments. Created 3 years, 8 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 "components/update_client/update_query_params.h"
5 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
6 #include "components/update_client/update_query_params.h"
7 #include "components/update_client/update_query_params_delegate.h" 7 #include "components/update_client/update_query_params_delegate.h"
8 #include "components/version_info/version_info.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 using base::StringPrintf; 11 using base::StringPrintf;
11 12
12 namespace update_client { 13 namespace update_client {
13 14
14 namespace { 15 namespace {
15 16
16 bool Contains(const std::string& source, const std::string& target) { 17 bool Contains(const std::string& source, const std::string& target) {
17 return source.find(target) != std::string::npos; 18 return source.find(target) != std::string::npos;
(...skipping 16 matching lines...) Expand all
34 Contains(params, StringPrintf("os=%s", UpdateQueryParams::GetOS()))); 35 Contains(params, StringPrintf("os=%s", UpdateQueryParams::GetOS())));
35 EXPECT_TRUE( 36 EXPECT_TRUE(
36 Contains(params, StringPrintf("arch=%s", UpdateQueryParams::GetArch()))); 37 Contains(params, StringPrintf("arch=%s", UpdateQueryParams::GetArch())));
37 EXPECT_TRUE(Contains( 38 EXPECT_TRUE(Contains(
38 params, 39 params,
39 StringPrintf("prod=%s", UpdateQueryParams::GetProdIdString(prod_id)))); 40 StringPrintf("prod=%s", UpdateQueryParams::GetProdIdString(prod_id))));
40 if (extra_params) 41 if (extra_params)
41 EXPECT_TRUE(Contains(params, "cat=dog")); 42 EXPECT_TRUE(Contains(params, "cat=dog"));
42 } 43 }
43 44
45 void TestProdVersion() {
46 EXPECT_EQ(version_info::GetVersionNumber(),
47 UpdateQueryParams::GetProdVersion());
48 }
49
44 TEST(UpdateQueryParamsTest, GetParams) { 50 TEST(UpdateQueryParamsTest, GetParams) {
51 TestProdVersion();
52
45 TestParams(UpdateQueryParams::CRX, false); 53 TestParams(UpdateQueryParams::CRX, false);
46 TestParams(UpdateQueryParams::CHROME, false); 54 TestParams(UpdateQueryParams::CHROME, false);
47 55
48 TestUpdateQueryParamsDelegate delegate; 56 TestUpdateQueryParamsDelegate delegate;
49 UpdateQueryParams::SetDelegate(&delegate); 57 UpdateQueryParams::SetDelegate(&delegate);
50 58
51 TestParams(UpdateQueryParams::CRX, true); 59 TestParams(UpdateQueryParams::CRX, true);
52 TestParams(UpdateQueryParams::CHROME, true); 60 TestParams(UpdateQueryParams::CHROME, true);
53 } 61 }
54 62
55 } // namespace update_client 63 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/update_query_params.cc ('k') | extensions/browser/updater/extension_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698