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

Unified Diff: chrome/browser/omaha_query_params/omaha_query_params_unittest.cc

Issue 153273002: Include the language (locale) info in the update ping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments, Unittest Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/omaha_query_params/omaha_query_params.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/omaha_query_params/omaha_query_params_unittest.cc
diff --git a/chrome/browser/omaha_query_params/omaha_query_params_unittest.cc b/chrome/browser/omaha_query_params/omaha_query_params_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e8a736aea300f7aabd1d7b11b1b791037f0b6c58
--- /dev/null
+++ b/chrome/browser/omaha_query_params/omaha_query_params_unittest.cc
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/omaha_query_params/omaha_query_params.h"
+
+#include "base/strings/stringprintf.h"
+#include "chrome/common/chrome_version_info.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using base::StringPrintf;
+
+namespace chrome {
+
+bool Contains(const std::string& source, const std::string& target) {
+ return source.find(target) != std::string::npos;
+}
+
+void TestParams(OmahaQueryParams::ProdId prod_id) {
+ std::string params = OmahaQueryParams::Get(prod_id);
+
+ // This doesn't so much test what the values are (since that would be an
+ // almost exact duplication of code with omaha_query_params.cc, and wouldn't
+ // really test anything) as it is a verification that all the params are
+ // present in the generated string.
+ EXPECT_TRUE(
+ Contains(params, StringPrintf("os=%s", OmahaQueryParams::GetOS())));
+ EXPECT_TRUE(
+ Contains(params, StringPrintf("arch=%s", OmahaQueryParams::GetArch())));
+ EXPECT_TRUE(Contains(
+ params,
+ StringPrintf("prod=%s", OmahaQueryParams::GetProdIdString(prod_id))));
+ EXPECT_TRUE(Contains(
+ params,
+ StringPrintf("prodchannel=%s", OmahaQueryParams::GetChannelString())));
+ EXPECT_TRUE(Contains(
+ params,
+ StringPrintf("prodversion=%s", chrome::VersionInfo().Version().c_str())));
+ EXPECT_TRUE(Contains(
+ params,
+ StringPrintf("lang=%s", OmahaQueryParams::GetLang())));
+}
+
+TEST(OmahaQueryParams, GetOmahaQueryParams) {
+ TestParams(OmahaQueryParams::CRX);
+ TestParams(OmahaQueryParams::CHROME);
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/browser/omaha_query_params/omaha_query_params.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698