| OLD | NEW |
| 1 // Copyright (c) 2011 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 "base/test/test_timeouts.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/automation_proxy.h" | 10 #include "chrome/test/automation/automation_proxy.h" |
| 11 #include "chrome/test/automation/browser_proxy.h" | 11 #include "chrome/test/automation/browser_proxy.h" |
| 12 #include "chrome/test/automation/tab_proxy.h" | 12 #include "chrome/test/automation/tab_proxy.h" |
| 13 #include "chrome/test/automation/window_proxy.h" | 13 #include "chrome/test/automation/window_proxy.h" |
| 14 | 14 |
| 15 class BookmarksUITest : public UITest { | 15 class BookmarksUITest : public UITest { |
| 16 public: | 16 public: |
| 17 BookmarksUITest() { | 17 BookmarksUITest() { |
| 18 dom_automation_enabled_ = true; | 18 dom_automation_enabled_ = true; |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool WaitForBookmarksUI(TabProxy* tab) { | 21 bool WaitForBookmarksUI(TabProxy* tab) { |
| 22 return WaitUntilJavaScriptCondition(tab, L"", | 22 return WaitUntilJavaScriptCondition(tab, L"", |
| 23 L"domAutomationController.send(" | 23 L"domAutomationController.send(" |
| 24 L" location.protocol == 'chrome-extension:' && " | 24 L" location.protocol == 'chrome-extension:' && " |
| 25 L" document.readyState == 'complete')", | 25 L" document.readyState == 'complete')", |
| 26 TestTimeouts::huge_test_timeout_ms()); | 26 TestTimeouts::large_test_timeout_ms()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 scoped_refptr<TabProxy> GetBookmarksUITab() { | 29 scoped_refptr<TabProxy> GetBookmarksUITab() { |
| 30 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 30 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 31 EXPECT_TRUE(browser.get()); | 31 EXPECT_TRUE(browser.get()); |
| 32 if (!browser.get()) | 32 if (!browser.get()) |
| 33 return NULL; | 33 return NULL; |
| 34 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 34 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 35 EXPECT_TRUE(tab.get()); | 35 EXPECT_TRUE(tab.get()); |
| 36 if (!tab.get()) | 36 if (!tab.get()) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 154 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 155 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 155 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 156 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 156 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 157 ASSERT_EQ(1, tab_count); | 157 ASSERT_EQ(1, tab_count); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TEST_F(BookmarksUITest, BookmarksLoaded) { | 160 TEST_F(BookmarksUITest, BookmarksLoaded) { |
| 161 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); | 161 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); |
| 162 ASSERT_TRUE(tab.get()); | 162 ASSERT_TRUE(tab.get()); |
| 163 } | 163 } |
| OLD | NEW |