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

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

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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/message_loop/message_loop.h"
9 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
10 #include "base/prefs/pref_service_factory.h" 9 #include "base/prefs/pref_service_factory.h"
11 #include "base/prefs/testing_pref_store.h" 10 #include "base/prefs/testing_pref_store.h"
12 #include "base/run_loop.h" 11 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h"
14 #include "components/bookmarks/browser/bookmark_model.h" 14 #include "components/bookmarks/browser/bookmark_model.h"
15 #include "components/bookmarks/common/bookmark_pref_names.h" 15 #include "components/bookmarks/common/bookmark_pref_names.h"
16 #include "components/bookmarks/test/bookmark_test_helpers.h" 16 #include "components/bookmarks/test/bookmark_test_helpers.h"
17 #include "components/bookmarks/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 namespace bookmarks { 21 namespace bookmarks {
22 22
23 scoped_ptr<PrefService> PrefServiceForTesting() { 23 scoped_ptr<PrefService> PrefServiceForTesting() {
(...skipping 25 matching lines...) Expand all
49 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest); 49 DISALLOW_COPY_AND_ASSIGN(BookmarkExpandedStateTrackerTest);
50 }; 50 };
51 51
52 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() {} 52 BookmarkExpandedStateTrackerTest::BookmarkExpandedStateTrackerTest() {}
53 53
54 BookmarkExpandedStateTrackerTest::~BookmarkExpandedStateTrackerTest() {} 54 BookmarkExpandedStateTrackerTest::~BookmarkExpandedStateTrackerTest() {}
55 55
56 void BookmarkExpandedStateTrackerTest::SetUp() { 56 void BookmarkExpandedStateTrackerTest::SetUp() {
57 prefs_ = PrefServiceForTesting(); 57 prefs_ = PrefServiceForTesting();
58 model_.reset(new BookmarkModel(&client_)); 58 model_.reset(new BookmarkModel(&client_));
59 model_->Load(prefs_.get(), 59 model_->Load(prefs_.get(), std::string(), base::FilePath(),
60 std::string(), 60 base::ThreadTaskRunnerHandle::Get(),
61 base::FilePath(), 61 base::ThreadTaskRunnerHandle::Get());
62 base::MessageLoopProxy::current(),
63 base::MessageLoopProxy::current());
64 test::WaitForBookmarkModelToLoad(model_.get()); 62 test::WaitForBookmarkModelToLoad(model_.get());
65 } 63 }
66 64
67 void BookmarkExpandedStateTrackerTest::TearDown() { 65 void BookmarkExpandedStateTrackerTest::TearDown() {
68 model_.reset(); 66 model_.reset();
69 } 67 }
70 68
71 // Various assertions for SetExpandedNodes. 69 // Various assertions for SetExpandedNodes.
72 TEST_F(BookmarkExpandedStateTrackerTest, SetExpandedNodes) { 70 TEST_F(BookmarkExpandedStateTrackerTest, SetExpandedNodes) {
73 BookmarkExpandedStateTracker* tracker = model_->expanded_state_tracker(); 71 BookmarkExpandedStateTracker* tracker = model_->expanded_state_tracker();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 tracker->SetExpandedNodes(nodes); 103 tracker->SetExpandedNodes(nodes);
106 // Verify that the node is present. 104 // Verify that the node is present.
107 EXPECT_EQ(nodes, tracker->GetExpandedNodes()); 105 EXPECT_EQ(nodes, tracker->GetExpandedNodes());
108 // Call remove all. 106 // Call remove all.
109 model_->RemoveAllUserBookmarks(); 107 model_->RemoveAllUserBookmarks();
110 // Verify node is not present. 108 // Verify node is not present.
111 EXPECT_TRUE(tracker->GetExpandedNodes().empty()); 109 EXPECT_TRUE(tracker->GetExpandedNodes().empty());
112 } 110 }
113 111
114 } // namespace bookmarks 112 } // namespace bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698