| 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 "base/bind.h" |    5 #include "base/bind.h" | 
|    6 #include "base/strings/utf_string_conversions.h" |    6 #include "base/strings/utf_string_conversions.h" | 
|    7 #include "base/timer/timer.h" |    7 #include "base/timer/timer.h" | 
|    8 #include "chrome/app/chrome_command_ids.h" |    8 #include "chrome/app/chrome_command_ids.h" | 
|    9 #include "chrome/browser/bookmarks/bookmark_model.h" |    9 #include "chrome/browser/bookmarks/bookmark_model.h" | 
|   10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |   10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   75   LOG(INFO) << "Took " << delay.InMilliseconds() << " ms to hide bookmark bar"; |   75   LOG(INFO) << "Took " << delay.InMilliseconds() << " ms to hide bookmark bar"; | 
|   76   ASSERT_FALSE(IsVisible()); |   76   ASSERT_FALSE(IsVisible()); | 
|   77 } |   77 } | 
|   78  |   78  | 
|   79 // Verify that bookmarks persist browser restart. |   79 // Verify that bookmarks persist browser restart. | 
|   80 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, PRE_Persist) { |   80 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, PRE_Persist) { | 
|   81   BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); |   81   BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); | 
|   82  |   82  | 
|   83   bookmark_utils::AddIfNotBookmarked( |   83   bookmark_utils::AddIfNotBookmarked( | 
|   84       bookmark_model, GURL(kPersistBookmarkURL), |   84       bookmark_model, GURL(kPersistBookmarkURL), | 
|   85       ASCIIToUTF16(kPersistBookmarkTitle)); |   85       base::ASCIIToUTF16(kPersistBookmarkTitle)); | 
|   86 } |   86 } | 
|   87  |   87  | 
|   88 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, Persist) { |   88 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, Persist) { | 
|   89   BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); |   89   BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); | 
|   90  |   90  | 
|   91   std::vector<BookmarkService::URLAndTitle> urls; |   91   std::vector<BookmarkService::URLAndTitle> urls; | 
|   92   bookmark_model->GetBookmarks(&urls); |   92   bookmark_model->GetBookmarks(&urls); | 
|   93  |   93  | 
|   94   ASSERT_EQ(1u, urls.size()); |   94   ASSERT_EQ(1u, urls.size()); | 
|   95   ASSERT_EQ(GURL(kPersistBookmarkURL), urls[0].url); |   95   ASSERT_EQ(GURL(kPersistBookmarkURL), urls[0].url); | 
|   96   ASSERT_EQ(ASCIIToUTF16(kPersistBookmarkTitle), urls[0].title); |   96   ASSERT_EQ(base::ASCIIToUTF16(kPersistBookmarkTitle), urls[0].title); | 
|   97 } |   97 } | 
|   98  |   98  | 
|   99 #if !defined(OS_CHROMEOS)  // No multi-profile on ChromeOS. |   99 #if !defined(OS_CHROMEOS)  // No multi-profile on ChromeOS. | 
|  100  |  100  | 
|  101 // Sanity check that bookmarks from different profiles are separate. |  101 // Sanity check that bookmarks from different profiles are separate. | 
|  102 // DISABLED_ because it regularly times out: http://crbug.com/159002. |  102 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 
|  103 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DISABLED_MultiProfile) { |  103 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DISABLED_MultiProfile) { | 
|  104   base::ScopedTempDir temp_dir; |  104   base::ScopedTempDir temp_dir; | 
|  105   ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |  105   ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 
|  106  |  106  | 
|  107   BookmarkModel* bookmark_model1 = WaitForBookmarkModel(browser()->profile()); |  107   BookmarkModel* bookmark_model1 = WaitForBookmarkModel(browser()->profile()); | 
|  108  |  108  | 
|  109   ui_test_utils::BrowserAddedObserver observer; |  109   ui_test_utils::BrowserAddedObserver observer; | 
|  110   g_browser_process->profile_manager()->CreateMultiProfileAsync( |  110   g_browser_process->profile_manager()->CreateMultiProfileAsync( | 
|  111       base::string16(), base::string16(), ProfileManager::CreateCallback(), |  111       base::string16(), base::string16(), ProfileManager::CreateCallback(), | 
|  112       std::string()); |  112       std::string()); | 
|  113   Browser* browser2 = observer.WaitForSingleNewBrowser(); |  113   Browser* browser2 = observer.WaitForSingleNewBrowser(); | 
|  114   BookmarkModel* bookmark_model2 = WaitForBookmarkModel(browser2->profile()); |  114   BookmarkModel* bookmark_model2 = WaitForBookmarkModel(browser2->profile()); | 
|  115  |  115  | 
|  116   bookmark_utils::AddIfNotBookmarked( |  116   bookmark_utils::AddIfNotBookmarked( | 
|  117       bookmark_model1, GURL(kPersistBookmarkURL), |  117       bookmark_model1, GURL(kPersistBookmarkURL), | 
|  118       ASCIIToUTF16(kPersistBookmarkTitle)); |  118       base::ASCIIToUTF16(kPersistBookmarkTitle)); | 
|  119   std::vector<BookmarkService::URLAndTitle> urls1, urls2; |  119   std::vector<BookmarkService::URLAndTitle> urls1, urls2; | 
|  120   bookmark_model1->GetBookmarks(&urls1); |  120   bookmark_model1->GetBookmarks(&urls1); | 
|  121   bookmark_model2->GetBookmarks(&urls2); |  121   bookmark_model2->GetBookmarks(&urls2); | 
|  122   ASSERT_EQ(1u, urls1.size()); |  122   ASSERT_EQ(1u, urls1.size()); | 
|  123   ASSERT_TRUE(urls2.empty()); |  123   ASSERT_TRUE(urls2.empty()); | 
|  124 } |  124 } | 
|  125  |  125  | 
|  126 #endif |  126 #endif | 
| OLD | NEW |