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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 19616004: Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add WARN_UNUSED_RESULT and assert_true in every caller. Created 7 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_model.h" 5 #include "chrome/browser/bookmarks/bookmark_model.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 bb_model_ = BookmarkModelFactory::GetForProfile(profile_.get()); 909 bb_model_ = BookmarkModelFactory::GetForProfile(profile_.get());
910 ui_test_utils::WaitForBookmarkModelToLoad(bb_model_); 910 ui_test_utils::WaitForBookmarkModelToLoad(bb_model_);
911 } 911 }
912 912
913 // Destroys the current profile, creates a new one and creates the history 913 // Destroys the current profile, creates a new one and creates the history
914 // service. 914 // service.
915 void RecreateProfile() { 915 void RecreateProfile() {
916 // Need to shutdown the old one before creating a new one. 916 // Need to shutdown the old one before creating a new one.
917 profile_.reset(NULL); 917 profile_.reset(NULL);
918 profile_.reset(new TestingProfile()); 918 profile_.reset(new TestingProfile());
919 profile_->CreateHistoryService(true, false); 919 ASSERT_TRUE(profile_->CreateHistoryService(true, false));
sky 2013/07/22 23:02:23 You need to wrap all calls to RecreateProfile() in
rmcilroy 2013/07/22 23:53:32 This method was never actually used, so I removed
920 } 920 }
921 921
922 // The profile. 922 // The profile.
923 scoped_ptr<TestingProfile> profile_; 923 scoped_ptr<TestingProfile> profile_;
924 BookmarkModel* bb_model_; 924 BookmarkModel* bb_model_;
925 925
926 private: 926 private:
927 content::TestBrowserThreadBundle thread_bundle_; 927 content::TestBrowserThreadBundle thread_bundle_;
928 }; 928 };
929 929
(...skipping 17 matching lines...) Expand all
947 { "a [ b ]", "" }, 947 { "a [ b ]", "" },
948 { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"}, 948 { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"},
949 }; 949 };
950 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 950 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
951 // Recreate the profile. We need to reset with NULL first so that the last 951 // Recreate the profile. We need to reset with NULL first so that the last
952 // HistoryService releases the locks on the files it creates and we can 952 // HistoryService releases the locks on the files it creates and we can
953 // delete them. 953 // delete them.
954 profile_.reset(NULL); 954 profile_.reset(NULL);
955 profile_.reset(new TestingProfile()); 955 profile_.reset(new TestingProfile());
956 profile_->CreateBookmarkModel(true); 956 profile_->CreateBookmarkModel(true);
957 profile_->CreateHistoryService(true, false); 957 ASSERT_TRUE(profile_->CreateHistoryService(true, false));
958 BlockTillBookmarkModelLoaded(); 958 BlockTillBookmarkModelLoaded();
959 959
960 TestNode bbn; 960 TestNode bbn;
961 PopulateNodeFromString(data[i].bbn_contents, &bbn); 961 PopulateNodeFromString(data[i].bbn_contents, &bbn);
962 PopulateBookmarkNode(&bbn, bb_model_, bb_model_->bookmark_bar_node()); 962 PopulateBookmarkNode(&bbn, bb_model_, bb_model_->bookmark_bar_node());
963 963
964 TestNode other; 964 TestNode other;
965 PopulateNodeFromString(data[i].other_contents, &other); 965 PopulateNodeFromString(data[i].other_contents, &other);
966 PopulateBookmarkNode(&other, bb_model_, bb_model_->other_node()); 966 PopulateBookmarkNode(&other, bb_model_, bb_model_->other_node());
967 967
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf")); 1126 EXPECT_TRUE(node.DeleteMetaInfo("key2.subkey2.leaf"));
1127 EXPECT_FALSE(node.DeleteMetaInfo("key3")); 1127 EXPECT_FALSE(node.DeleteMetaInfo("key3"));
1128 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value)); 1128 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value));
1129 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value)); 1129 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value));
1130 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value)); 1130 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value));
1131 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value)); 1131 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value));
1132 EXPECT_TRUE(node.meta_info_str().empty()); 1132 EXPECT_TRUE(node.meta_info_str().empty());
1133 } 1133 }
1134 1134
1135 } // namespace 1135 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_index_unittest.cc ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698