| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "base/version.h" | 7 #include "base/version.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "components/update_client/updater_state.h" | 9 #include "components/update_client/updater_state.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Sanity check all members. | 36 // Sanity check all members. |
| 37 EXPECT_STREQ("the updater", attributes.at("name").c_str()); | 37 EXPECT_STREQ("the updater", attributes.at("name").c_str()); |
| 38 EXPECT_STREQ("1.0", attributes.at("version").c_str()); | 38 EXPECT_STREQ("1.0", attributes.at("version").c_str()); |
| 39 EXPECT_STREQ("0", attributes.at("laststarted").c_str()); | 39 EXPECT_STREQ("0", attributes.at("laststarted").c_str()); |
| 40 EXPECT_STREQ("0", attributes.at("lastchecked").c_str()); | 40 EXPECT_STREQ("0", attributes.at("lastchecked").c_str()); |
| 41 EXPECT_STREQ("0", attributes.at("domainjoined").c_str()); | 41 EXPECT_STREQ("0", attributes.at("domainjoined").c_str()); |
| 42 EXPECT_STREQ("1", attributes.at("autoupdatecheckenabled").c_str()); | 42 EXPECT_STREQ("1", attributes.at("autoupdatecheckenabled").c_str()); |
| 43 EXPECT_STREQ("1", attributes.at("updatepolicy").c_str()); | 43 EXPECT_STREQ("1", attributes.at("updatepolicy").c_str()); |
| 44 | 44 |
| 45 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 45 #if defined(GOOGLE_CHROME_BUILD) |
| 46 // The name of the Windows updater for Chrome. | 46 #if defined(OS_WIN) |
| 47 EXPECT_STREQ("Omaha", UpdaterState::GetState(false)->at("name").c_str()); | 47 // The name of the Windows updater for Chrome. |
| 48 EXPECT_STREQ("Omaha", UpdaterState::GetState(false)->at("name").c_str()); |
| 49 #elif defined(OS_MACOSX) |
| 50 EXPECT_STREQ("Keystone", UpdaterState::GetState(false)->at("name").c_str()); |
| 51 #endif |
| 48 #endif // GOOGLE_CHROME_BUILD | 52 #endif // GOOGLE_CHROME_BUILD |
| 49 | 53 |
| 50 // Tests some of the remaining values. | 54 // Tests some of the remaining values. |
| 51 updater_state = UpdaterState(false); | 55 updater_state = UpdaterState(false); |
| 52 | 56 |
| 53 // Don't serialize an invalid version if it could not be read. | 57 // Don't serialize an invalid version if it could not be read. |
| 54 updater_state.updater_version_ = base::Version(); | 58 updater_state.updater_version_ = base::Version(); |
| 55 attributes = updater_state.BuildAttributes(); | 59 attributes = updater_state.BuildAttributes(); |
| 56 EXPECT_EQ(0u, attributes.count("version")); | 60 EXPECT_EQ(0u, attributes.count("version")); |
| 57 | 61 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 updater_state.update_policy_ = 0; | 104 updater_state.update_policy_ = 0; |
| 101 attributes = updater_state.BuildAttributes(); | 105 attributes = updater_state.BuildAttributes(); |
| 102 EXPECT_STREQ("0", attributes.at("updatepolicy").c_str()); | 106 EXPECT_STREQ("0", attributes.at("updatepolicy").c_str()); |
| 103 | 107 |
| 104 updater_state.update_policy_ = -1; | 108 updater_state.update_policy_ = -1; |
| 105 attributes = updater_state.BuildAttributes(); | 109 attributes = updater_state.BuildAttributes(); |
| 106 EXPECT_STREQ("-1", attributes.at("updatepolicy").c_str()); | 110 EXPECT_STREQ("-1", attributes.at("updatepolicy").c_str()); |
| 107 } | 111 } |
| 108 | 112 |
| 109 } // namespace update_client | 113 } // namespace update_client |
| OLD | NEW |