| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 ShortcutHandler shortcut; | 960 ShortcutHandler shortcut; |
| 961 ShortcutCommand command_line = shortcut.CreateWithArguments( | 961 ShortcutCommand command_line = shortcut.CreateWithArguments( |
| 962 base::ASCIIToUTF16("chrome.lnk"), | 962 base::ASCIIToUTF16("chrome.lnk"), |
| 963 base::ASCIIToUTF16("--profile-directory=Default foo.com")); | 963 base::ASCIIToUTF16("--profile-directory=Default foo.com")); |
| 964 | 964 |
| 965 ResettableSettingsSnapshot nonorganic_snap(profile()); | 965 ResettableSettingsSnapshot nonorganic_snap(profile()); |
| 966 nonorganic_snap.RequestShortcuts(base::Closure()); | 966 nonorganic_snap.RequestShortcuts(base::Closure()); |
| 967 // Let it enumerate shortcuts on the FILE thread. | 967 // Let it enumerate shortcuts on the FILE thread. |
| 968 base::MessageLoop::current()->RunUntilIdle(); | 968 base::MessageLoop::current()->RunUntilIdle(); |
| 969 | 969 |
| 970 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 970 static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
| 971 expand_this_test); | 971 "this test needs to be expanded"); |
| 972 for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; | 972 for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; |
| 973 ++field_mask) { | 973 ++field_mask) { |
| 974 std::string report = SerializeSettingsReport(nonorganic_snap, field_mask); | 974 std::string report = SerializeSettingsReport(nonorganic_snap, field_mask); |
| 975 JSONStringValueSerializer json(report); | 975 JSONStringValueSerializer json(report); |
| 976 std::string error; | 976 std::string error; |
| 977 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); | 977 scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); |
| 978 ASSERT_TRUE(root) << error; | 978 ASSERT_TRUE(root) << error; |
| 979 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)) << error; | 979 ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)) << error; |
| 980 | 980 |
| 981 base::DictionaryValue* dict = | 981 base::DictionaryValue* dict = |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 new ResettableSettingsSnapshot(profile())); | 1097 new ResettableSettingsSnapshot(profile())); |
| 1098 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1098 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
| 1099 base::Unretained(&capture))); | 1099 base::Unretained(&capture))); |
| 1100 deleted_snapshot.reset(); | 1100 deleted_snapshot.reset(); |
| 1101 // Running remaining tasks shouldn't trigger the callback to be called as | 1101 // Running remaining tasks shouldn't trigger the callback to be called as |
| 1102 // |deleted_snapshot| was deleted before it could run. | 1102 // |deleted_snapshot| was deleted before it could run. |
| 1103 base::MessageLoop::current()->RunUntilIdle(); | 1103 base::MessageLoop::current()->RunUntilIdle(); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 } // namespace | 1106 } // namespace |
| OLD | NEW |