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

Side by Side Diff: chrome/installer/util/uninstall_metrics_unittest.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/installer/util/uninstall_metrics.cc ('k') | chrome/installer/util/work_item_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/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"
(...skipping 18 matching lines...) Expand all
39 base::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 JSONStringValueDeserializer json_deserializer(pref_string); 46 JSONStringValueDeserializer json_deserializer(pref_string);
47 std::string error_message; 47 std::string error_message;
48 48
49 scoped_ptr<base::Value> root = 49 std::unique_ptr<base::Value> root =
50 json_deserializer.Deserialize(NULL, &error_message); 50 json_deserializer.Deserialize(NULL, &error_message);
51 ASSERT_TRUE(root.get()); 51 ASSERT_TRUE(root.get());
52 base::string16 uninstall_metrics_string; 52 base::string16 uninstall_metrics_string;
53 53
54 EXPECT_TRUE( 54 EXPECT_TRUE(
55 ExtractUninstallMetrics(*static_cast<base::DictionaryValue*>(root.get()), 55 ExtractUninstallMetrics(*static_cast<base::DictionaryValue*>(root.get()),
56 &uninstall_metrics_string)); 56 &uninstall_metrics_string));
57 EXPECT_EQ(expected_url_string, uninstall_metrics_string); 57 EXPECT_EQ(expected_url_string, uninstall_metrics_string);
58 } 58 }
59 59
60 } // namespace installer 60 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/uninstall_metrics.cc ('k') | chrome/installer/util/work_item_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698