| 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" |
| 11 #include "base/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace installer { | 14 namespace installer { |
| 15 | 15 |
| 16 TEST(UninstallMetricsTest, TestExtractUninstallMetrics) { | 16 TEST(UninstallMetricsTest, TestExtractUninstallMetrics) { |
| 17 // A make-believe JSON preferences file. | 17 // A make-believe JSON preferences file. |
| 18 std::string pref_string( | 18 std::string pref_string( |
| 19 "{ \n" | 19 "{ \n" |
| 20 " \"foo\": \"bar\",\n" | 20 " \"foo\": \"bar\",\n" |
| 21 " \"uninstall_metrics\": { \n" | 21 " \"uninstall_metrics\": { \n" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 ASSERT_TRUE(root.get()); | 50 ASSERT_TRUE(root.get()); |
| 51 string16 uninstall_metrics_string; | 51 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 |