| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 11 #include "chrome/test/automation/tab_proxy.h" |
| 11 #include "chrome/test/automation/window_proxy.h" | 12 #include "chrome/test/automation/window_proxy.h" |
| 12 | 13 |
| 13 class BookmarksUITest : public UITest { | 14 class BookmarksUITest : public UITest { |
| 14 public: | 15 public: |
| 15 BookmarksUITest() { | 16 BookmarksUITest() { |
| 16 dom_automation_enabled_ = true; | 17 dom_automation_enabled_ = true; |
| 17 } | 18 } |
| 18 | 19 |
| 19 bool WaitForBookmarksUI(TabProxy* tab) { | 20 bool WaitForBookmarksUI(TabProxy* tab) { |
| 20 return WaitUntilJavaScriptCondition(tab, L"", | 21 return WaitUntilJavaScriptCondition(tab, L"", |
| 21 L"domAutomationController.send(" | 22 L"domAutomationController.send(" |
| 22 L" location.protocol == 'chrome-extension:' && " | 23 L" location.protocol == 'chrome-extension:' && " |
| 23 L" document.readyState == 'complete')", | 24 L" document.readyState == 'complete')", |
| 24 test_timeout_ms()); | 25 TestTimeouts::huge_test_timeout_ms()); |
| 25 } | 26 } |
| 26 | 27 |
| 27 scoped_refptr<TabProxy> GetBookmarksUITab() { | 28 scoped_refptr<TabProxy> GetBookmarksUITab() { |
| 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 29 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 29 EXPECT_TRUE(browser.get()); | 30 EXPECT_TRUE(browser.get()); |
| 30 if (!browser.get()) | 31 if (!browser.get()) |
| 31 return NULL; | 32 return NULL; |
| 32 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 33 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 33 EXPECT_TRUE(tab.get()); | 34 EXPECT_TRUE(tab.get()); |
| 34 if (!tab.get()) | 35 if (!tab.get()) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 142 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 142 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 143 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 143 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 144 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 144 ASSERT_EQ(2, tab_count); | 145 ASSERT_EQ(2, tab_count); |
| 145 } | 146 } |
| 146 | 147 |
| 147 TEST_F(BookmarksUITest, BookmarksLoaded) { | 148 TEST_F(BookmarksUITest, BookmarksLoaded) { |
| 148 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); | 149 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); |
| 149 ASSERT_TRUE(tab.get()); | 150 ASSERT_TRUE(tab.get()); |
| 150 } | 151 } |
| OLD | NEW |