| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 EXPECT_EQ(url1.spec(), data[1]->GetURL().spec()); | 2784 EXPECT_EQ(url1.spec(), data[1]->GetURL().spec()); |
| 2785 EXPECT_EQ(url1_id, data[1]->GetID()); | 2785 EXPECT_EQ(url1_id, data[1]->GetID()); |
| 2786 EXPECT_EQ(segment1_time_delta.InHours(), data[1]->duration().InHours()); | 2786 EXPECT_EQ(segment1_time_delta.InHours(), data[1]->duration().InHours()); |
| 2787 } | 2787 } |
| 2788 | 2788 |
| 2789 // Simple test that removes a bookmark. This test exercises the code paths in | 2789 // Simple test that removes a bookmark. This test exercises the code paths in |
| 2790 // History that block till bookmark bar model is loaded. | 2790 // History that block till bookmark bar model is loaded. |
| 2791 TEST_F(HistoryBackendTest, RemoveNotification) { | 2791 TEST_F(HistoryBackendTest, RemoveNotification) { |
| 2792 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 2792 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
| 2793 | 2793 |
| 2794 profile->CreateHistoryService(false, false); | 2794 ASSERT_TRUE(profile->CreateHistoryService(false, false)); |
| 2795 profile->CreateBookmarkModel(true); | 2795 profile->CreateBookmarkModel(true); |
| 2796 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile.get()); | 2796 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile.get()); |
| 2797 ui_test_utils::WaitForBookmarkModelToLoad(model); | 2797 ui_test_utils::WaitForBookmarkModelToLoad(model); |
| 2798 | 2798 |
| 2799 // Add a URL. | 2799 // Add a URL. |
| 2800 GURL url("http://www.google.com"); | 2800 GURL url("http://www.google.com"); |
| 2801 bookmark_utils::AddIfNotBookmarked(model, url, base::string16()); | 2801 bookmark_utils::AddIfNotBookmarked(model, url, base::string16()); |
| 2802 | 2802 |
| 2803 HistoryService* service = HistoryServiceFactory::GetForProfile( | 2803 HistoryService* service = HistoryServiceFactory::GetForProfile( |
| 2804 profile.get(), Profile::EXPLICIT_ACCESS); | 2804 profile.get(), Profile::EXPLICIT_ACCESS); |
| 2805 | 2805 |
| 2806 service->AddPage( | 2806 service->AddPage( |
| 2807 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), | 2807 url, base::Time::Now(), NULL, 1, GURL(), RedirectList(), |
| 2808 content::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); | 2808 content::PAGE_TRANSITION_TYPED, SOURCE_BROWSED, false); |
| 2809 | 2809 |
| 2810 // This won't actually delete the URL, rather it'll empty out the visits. | 2810 // This won't actually delete the URL, rather it'll empty out the visits. |
| 2811 // This triggers blocking on the BookmarkModel. | 2811 // This triggers blocking on the BookmarkModel. |
| 2812 service->DeleteURL(url); | 2812 service->DeleteURL(url); |
| 2813 } | 2813 } |
| 2814 | 2814 |
| 2815 } // namespace history | 2815 } // namespace history |
| OLD | NEW |