| 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 "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/chrome_pages.h" | 9 #include "chrome/browser/ui/chrome_pages.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 17 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 18 | 18 |
| 19 class BookmarksTest : public InProcessBrowserTest { | 19 class BookmarksTest : public InProcessBrowserTest { |
| 20 public: | 20 public: |
| 21 BookmarksTest() {} | 21 BookmarksTest() {} |
| 22 | 22 |
| 23 void OpenBookmarksManager() { | 23 void OpenBookmarksManager() { |
| 24 content::TestNavigationObserver navigation_observer( | 24 content::TestNavigationObserver navigation_observer( |
| 25 content::NotificationService::AllSources(), NULL, 2); | 25 content::NotificationService::AllSources(), 2); |
| 26 | 26 |
| 27 // Bring up the bookmarks manager tab. | 27 // Bring up the bookmarks manager tab. |
| 28 chrome::ShowBookmarkManager(browser()); | 28 chrome::ShowBookmarkManager(browser()); |
| 29 navigation_observer.Wait(); | 29 navigation_observer.Wait(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void AssertIsBookmarksPage(content::WebContents* tab) { | 32 void AssertIsBookmarksPage(content::WebContents* tab) { |
| 33 GURL url; | 33 GURL url; |
| 34 std::string out; | 34 std::string out; |
| 35 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 35 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 navigation_observer.Wait(); | 98 navigation_observer.Wait(); |
| 99 | 99 |
| 100 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 100 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) { | 103 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) { |
| 104 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); | 104 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); |
| 105 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 105 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
| 106 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); | 106 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); |
| 107 } | 107 } |
| OLD | NEW |