| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/bookmarks/core/browser/bookmark_expanded_state_tracker.h" | 5 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/pref_service_factory.h" | 10 #include "base/prefs/pref_service_factory.h" |
| 11 #include "base/prefs/testing_pref_store.h" | 11 #include "base/prefs/testing_pref_store.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "components/bookmarks/core/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
| 15 #include "components/bookmarks/core/common/bookmark_pref_names.h" | 15 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 16 #include "components/bookmarks/core/test/bookmark_test_helpers.h" | 16 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 17 #include "components/bookmarks/core/test/test_bookmark_client.h" | 17 #include "components/bookmarks/test/test_bookmark_client.h" |
| 18 #include "components/pref_registry/pref_registry_syncable.h" | 18 #include "components/pref_registry/pref_registry_syncable.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 scoped_ptr<PrefService> PrefServiceForTesting() { | 21 scoped_ptr<PrefService> PrefServiceForTesting() { |
| 22 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | 22 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( |
| 23 new user_prefs::PrefRegistrySyncable()); | 23 new user_prefs::PrefRegistrySyncable()); |
| 24 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, | 24 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, |
| 25 new base::ListValue, | 25 new base::ListValue, |
| 26 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 26 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 27 base::PrefServiceFactory factory; | 27 base::PrefServiceFactory factory; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 BookmarkExpandedStateTracker::Nodes nodes; | 101 BookmarkExpandedStateTracker::Nodes nodes; |
| 102 nodes.insert(n1); | 102 nodes.insert(n1); |
| 103 tracker->SetExpandedNodes(nodes); | 103 tracker->SetExpandedNodes(nodes); |
| 104 // Verify that the node is present. | 104 // Verify that the node is present. |
| 105 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); | 105 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); |
| 106 // Call remove all. | 106 // Call remove all. |
| 107 model_->RemoveAll(); | 107 model_->RemoveAll(); |
| 108 // Verify node is not present. | 108 // Verify node is not present. |
| 109 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); | 109 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); |
| 110 } | 110 } |
| OLD | NEW |