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 "components/update_client/updater_state.h" | 8 #include "components/update_client/updater_state.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // Sanity check all members. | 35 // Sanity check all members. |
36 EXPECT_STREQ("the updater", attributes.at("name").c_str()); | 36 EXPECT_STREQ("the updater", attributes.at("name").c_str()); |
37 EXPECT_STREQ("1.0", attributes.at("version").c_str()); | 37 EXPECT_STREQ("1.0", attributes.at("version").c_str()); |
38 EXPECT_STREQ("0", attributes.at("laststarted").c_str()); | 38 EXPECT_STREQ("0", attributes.at("laststarted").c_str()); |
39 EXPECT_STREQ("0", attributes.at("lastchecked").c_str()); | 39 EXPECT_STREQ("0", attributes.at("lastchecked").c_str()); |
40 EXPECT_STREQ("0", attributes.at("domainjoined").c_str()); | 40 EXPECT_STREQ("0", attributes.at("domainjoined").c_str()); |
41 EXPECT_STREQ("1", attributes.at("autoupdatecheckenabled").c_str()); | 41 EXPECT_STREQ("1", attributes.at("autoupdatecheckenabled").c_str()); |
42 EXPECT_STREQ("1", attributes.at("updatepolicy").c_str()); | 42 EXPECT_STREQ("1", attributes.at("updatepolicy").c_str()); |
43 | 43 |
44 #if defined(GOOGLE_CHROME_BUILD) | 44 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
45 // The name of the Windows updater for Chrome. | 45 // The name of the Windows updater for Chrome. |
46 EXPECT_STREQ("Omaha", UpdaterState::GetState(false)->at("name").c_str()); | 46 EXPECT_STREQ("Omaha", UpdaterState::GetState(false)->at("name").c_str()); |
47 #endif // GOOGLE_CHROME_BUILD | 47 #endif // GOOGLE_CHROME_BUILD |
48 | 48 |
49 // Tests some of the remaining values. | 49 // Tests some of the remaining values. |
50 updater_state = UpdaterState(false); | 50 updater_state = UpdaterState(false); |
51 | 51 |
52 // Don't serialize an invalid version if it could not be read. | 52 // Don't serialize an invalid version if it could not be read. |
53 updater_state.updater_version_ = base::Version(); | 53 updater_state.updater_version_ = base::Version(); |
54 attributes = updater_state.BuildAttributes(); | 54 attributes = updater_state.BuildAttributes(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 updater_state.update_policy_ = 0; | 99 updater_state.update_policy_ = 0; |
100 attributes = updater_state.BuildAttributes(); | 100 attributes = updater_state.BuildAttributes(); |
101 EXPECT_STREQ("0", attributes.at("updatepolicy").c_str()); | 101 EXPECT_STREQ("0", attributes.at("updatepolicy").c_str()); |
102 | 102 |
103 updater_state.update_policy_ = -1; | 103 updater_state.update_policy_ = -1; |
104 attributes = updater_state.BuildAttributes(); | 104 attributes = updater_state.BuildAttributes(); |
105 EXPECT_STREQ("-1", attributes.at("updatepolicy").c_str()); | 105 EXPECT_STREQ("-1", attributes.at("updatepolicy").c_str()); |
106 } | 106 } |
107 | 107 |
108 } // namespace update_client | 108 } // namespace update_client |
OLD | NEW |