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

Side by Side Diff: components/bookmarks/browser/bookmark_expanded_state_tracker_unittest.cc

Issue 2082333002: Remove calls to deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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/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/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
13 #include "components/bookmarks/browser/bookmark_model.h" 14 #include "components/bookmarks/browser/bookmark_model.h"
14 #include "components/bookmarks/common/bookmark_pref_names.h" 15 #include "components/bookmarks/common/bookmark_pref_names.h"
15 #include "components/bookmarks/test/bookmark_test_helpers.h" 16 #include "components/bookmarks/test/bookmark_test_helpers.h"
16 #include "components/bookmarks/test/test_bookmark_client.h" 17 #include "components/bookmarks/test/test_bookmark_client.h"
17 #include "components/prefs/pref_registry_simple.h" 18 #include "components/prefs/pref_registry_simple.h"
18 #include "components/prefs/testing_pref_service.h" 19 #include "components/prefs/testing_pref_service.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
(...skipping 26 matching lines...) Expand all
47 prefs_.registry()->RegisterListPref(prefs::kManagedBookmarks); 48 prefs_.registry()->RegisterListPref(prefs::kManagedBookmarks);
48 model_.reset(new BookmarkModel(base::WrapUnique(new TestBookmarkClient()))); 49 model_.reset(new BookmarkModel(base::WrapUnique(new TestBookmarkClient())));
49 model_->Load(&prefs_, base::FilePath(), 50 model_->Load(&prefs_, base::FilePath(),
50 base::ThreadTaskRunnerHandle::Get(), 51 base::ThreadTaskRunnerHandle::Get(),
51 base::ThreadTaskRunnerHandle::Get()); 52 base::ThreadTaskRunnerHandle::Get());
52 test::WaitForBookmarkModelToLoad(model_.get()); 53 test::WaitForBookmarkModelToLoad(model_.get());
53 } 54 }
54 55
55 void BookmarkExpandedStateTrackerTest::TearDown() { 56 void BookmarkExpandedStateTrackerTest::TearDown() {
56 model_.reset(); 57 model_.reset();
57 message_loop_.RunUntilIdle(); 58 base::RunLoop().RunUntilIdle();
58 } 59 }
59 60
60 // Various assertions for SetExpandedNodes. 61 // Various assertions for SetExpandedNodes.
61 TEST_F(BookmarkExpandedStateTrackerTest, SetExpandedNodes) { 62 TEST_F(BookmarkExpandedStateTrackerTest, SetExpandedNodes) {
62 BookmarkExpandedStateTracker* tracker = model_->expanded_state_tracker(); 63 BookmarkExpandedStateTracker* tracker = model_->expanded_state_tracker();
63 64
64 // Should start out initially empty. 65 // Should start out initially empty.
65 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); 66 EXPECT_TRUE(tracker->GetExpandedNodes().empty());
66 67
67 BookmarkExpandedStateTracker::Nodes nodes; 68 BookmarkExpandedStateTracker::Nodes nodes;
(...skipping 26 matching lines...) Expand all
94 tracker->SetExpandedNodes(nodes); 95 tracker->SetExpandedNodes(nodes);
95 // Verify that the node is present. 96 // Verify that the node is present.
96 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); 97 EXPECT_EQ(nodes, tracker->GetExpandedNodes());
97 // Call remove all. 98 // Call remove all.
98 model_->RemoveAllUserBookmarks(); 99 model_->RemoveAllUserBookmarks();
99 // Verify node is not present. 100 // Verify node is not present.
100 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); 101 EXPECT_TRUE(tracker->GetExpandedNodes().empty());
101 } 102 }
102 103
103 } // namespace bookmarks 104 } // namespace bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698