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

Unified Diff: components/update_client/utils_unittest.cc

Issue 2888183003: Consolidate the update_client serialization code. (Closed)
Patch Set: . Created 3 years, 7 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
Index: components/update_client/utils_unittest.cc
diff --git a/components/update_client/utils_unittest.cc b/components/update_client/utils_unittest.cc
index 8cadf1382ffce379062694a5cbf31c0738a0378b..d3d4f189d58d522c68a64ece6008b9e5f66cd0f8 100644
--- a/components/update_client/utils_unittest.cc
+++ b/components/update_client/utils_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/files/file_path.h"
-#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "components/update_client/updater_state.h"
#include "components/update_client/utils.h"
@@ -25,27 +24,6 @@ base::FilePath MakeTestFilePath(const char* file) {
namespace update_client {
-TEST(UpdateClientUtils, BuildProtocolRequest_ProdIdVersion) {
- // Verifies that |prod_id| and |version| are serialized.
- const string request = BuildProtocolRequest("some_prod_id", "1.0", "", "", "",
- "", "", "", nullptr);
- EXPECT_NE(string::npos, request.find(" version=\"some_prod_id-1.0\" "));
-}
-
-TEST(UpdateClientUtils, BuildProtocolRequest_DownloadPreference) {
- // Verifies that an empty |download_preference| is not serialized.
- const string request_no_dlpref =
- BuildProtocolRequest("", "", "", "", "", "", "", "", nullptr);
- EXPECT_EQ(string::npos, request_no_dlpref.find(" dlpref="));
-
- // Verifies that |download_preference| is serialized.
- const string request_with_dlpref =
- BuildProtocolRequest("", "", "", "", "", "some pref", "", "", nullptr);
- EXPECT_NE(string::npos, request_with_dlpref.find(" dlpref=\"some pref\""));
-}
-
-TEST(UpdateClientUtils, BuildProtocolRequest_UpdaterState) {}
-
TEST(UpdateClientUtils, VerifyFileHash256) {
EXPECT_TRUE(VerifyFileHash256(
MakeTestFilePath("jebgalgnebhfojomionfpkfelancnnkf.crx"),
@@ -170,35 +148,4 @@ TEST(UpdateClientUtils, RemoveUnsecureUrls) {
EXPECT_EQ(0u, urls.size());
}
-TEST(UpdateClientUtils, BuildProtocolRequestUpdaterStateAttributes) {
- // When no updater state is provided, then check that the elements and
- // attributes related to the updater state are not serialized.
- std::string request =
- BuildProtocolRequest("", "", "", "", "", "", "", "", nullptr).c_str();
- EXPECT_EQ(std::string::npos, request.find(" domainjoined"));
- EXPECT_EQ(std::string::npos, request.find("<updater"));
-
- UpdaterState::Attributes attributes;
- attributes["domainjoined"] = "1";
- attributes["name"] = "Omaha";
- attributes["version"] = "1.2.3.4";
- attributes["laststarted"] = "1";
- attributes["lastchecked"] = "2";
- attributes["autoupdatecheckenabled"] = "0";
- attributes["updatepolicy"] = "-1";
- request = BuildProtocolRequest(
- "", "", "", "", "", "", "", "",
- base::MakeUnique<UpdaterState::Attributes>(attributes));
- EXPECT_NE(std::string::npos, request.find(" domainjoined=\"1\""));
- const std::string updater_element =
- "<updater autoupdatecheckenabled=\"0\" "
- "lastchecked=\"2\" laststarted=\"1\" name=\"Omaha\" "
- "updatepolicy=\"-1\" version=\"1.2.3.4\"/>";
-#if defined(GOOGLE_CHROME_BUILD)
- EXPECT_NE(std::string::npos, request.find(updater_element));
-#else
- EXPECT_EQ(std::string::npos, request.find(updater_element));
-#endif // GOOGLE_CHROME_BUILD
-}
-
} // namespace update_client
« components/update_client/protocol_builder.h ('K') | « components/update_client/utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698