OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/installer/util/uninstall_metrics.h" | 5 #include "chrome/installer/util/uninstall_metrics.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 " \"blah\": {\n" | 29 " \"blah\": {\n" |
30 " \"this_sentence_is_true\": false\n" | 30 " \"this_sentence_is_true\": false\n" |
31 " },\n" | 31 " },\n" |
32 " \"user_experience_metrics\": { \n" | 32 " \"user_experience_metrics\": { \n" |
33 " \"client_id_timestamp\": \"1234567890\"," | 33 " \"client_id_timestamp\": \"1234567890\"," |
34 " \"reporting_enabled\": true\n" | 34 " \"reporting_enabled\": true\n" |
35 " }\n" | 35 " }\n" |
36 "} \n"); | 36 "} \n"); |
37 | 37 |
38 // The URL string we expect to be generated from said make-believe file. | 38 // The URL string we expect to be generated from said make-believe file. |
39 string16 expected_url_string( | 39 base::string16 expected_url_string( |
40 L"&installation_date2=1235341141" | 40 L"&installation_date2=1235341141" |
41 L"&last_launch_time_sec=1235341118" | 41 L"&last_launch_time_sec=1235341118" |
42 L"&last_observed_running_time_sec=1235341183" | 42 L"&last_observed_running_time_sec=1235341183" |
43 L"&launch_count=11&page_load_count=68" | 43 L"&launch_count=11&page_load_count=68" |
44 L"&uptime_sec=809"); | 44 L"&uptime_sec=809"); |
45 | 45 |
46 JSONStringValueSerializer json_deserializer(pref_string); | 46 JSONStringValueSerializer json_deserializer(pref_string); |
47 std::string error_message; | 47 std::string error_message; |
48 | 48 |
49 scoped_ptr<Value> root(json_deserializer.Deserialize(NULL, &error_message)); | 49 scoped_ptr<Value> root(json_deserializer.Deserialize(NULL, &error_message)); |
50 ASSERT_TRUE(root.get()); | 50 ASSERT_TRUE(root.get()); |
51 string16 uninstall_metrics_string; | 51 base::string16 uninstall_metrics_string; |
52 | 52 |
53 EXPECT_TRUE( | 53 EXPECT_TRUE( |
54 ExtractUninstallMetrics(*static_cast<DictionaryValue*>(root.get()), | 54 ExtractUninstallMetrics(*static_cast<DictionaryValue*>(root.get()), |
55 &uninstall_metrics_string)); | 55 &uninstall_metrics_string)); |
56 EXPECT_EQ(expected_url_string, uninstall_metrics_string); | 56 EXPECT_EQ(expected_url_string, uninstall_metrics_string); |
57 } | 57 } |
58 | 58 |
59 } // namespace installer | 59 } // namespace installer |
OLD | NEW |