OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/scoped_path_override.h" | 10 #include "base/test/scoped_path_override.h" |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 ResettableSettingsSnapshot nonorganic_snap(profile()); | 953 ResettableSettingsSnapshot nonorganic_snap(profile()); |
954 nonorganic_snap.RequestShortcuts(base::Closure()); | 954 nonorganic_snap.RequestShortcuts(base::Closure()); |
955 // Let it enumerate shortcuts on the FILE thread. | 955 // Let it enumerate shortcuts on the FILE thread. |
956 base::MessageLoop::current()->RunUntilIdle(); | 956 base::MessageLoop::current()->RunUntilIdle(); |
957 | 957 |
958 static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 958 static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
959 "this test needs to be expanded"); | 959 "this test needs to be expanded"); |
960 for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; | 960 for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; |
961 ++field_mask) { | 961 ++field_mask) { |
962 std::string report = SerializeSettingsReport(nonorganic_snap, field_mask); | 962 std::string report = SerializeSettingsReport(nonorganic_snap, field_mask); |
963 JSONStringValueSerializer json(report); | 963 JSONStringValueDeserializer json(report); |
964 std::string error; | 964 std::string error; |
965 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); | 965 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); |
966 ASSERT_TRUE(root) << error; | 966 ASSERT_TRUE(root) << error; |
967 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)) << error; | 967 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)) << error; |
968 | 968 |
969 base::DictionaryValue* dict = | 969 base::DictionaryValue* dict = |
970 static_cast<base::DictionaryValue*>(root.get()); | 970 static_cast<base::DictionaryValue*>(root.get()); |
971 | 971 |
972 base::ListValue* startup_urls = NULL; | 972 base::ListValue* startup_urls = NULL; |
973 int startup_type = 0; | 973 int startup_type = 0; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 new ResettableSettingsSnapshot(profile())); | 1085 new ResettableSettingsSnapshot(profile())); |
1086 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1086 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
1087 base::Unretained(&capture))); | 1087 base::Unretained(&capture))); |
1088 deleted_snapshot.reset(); | 1088 deleted_snapshot.reset(); |
1089 // Running remaining tasks shouldn't trigger the callback to be called as | 1089 // Running remaining tasks shouldn't trigger the callback to be called as |
1090 // |deleted_snapshot| was deleted before it could run. | 1090 // |deleted_snapshot| was deleted before it could run. |
1091 base::MessageLoop::current()->RunUntilIdle(); | 1091 base::MessageLoop::current()->RunUntilIdle(); |
1092 } | 1092 } |
1093 | 1093 |
1094 } // namespace | 1094 } // namespace |
OLD | NEW |