| 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 "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/browser_proxy.h" | 11 #include "chrome/test/automation/browser_proxy.h" |
| 11 #include "chrome/test/automation/tab_proxy.h" | 12 #include "chrome/test/automation/tab_proxy.h" |
| 12 #include "chrome/test/automation/window_proxy.h" | 13 #include "chrome/test/automation/window_proxy.h" |
| 13 | 14 |
| 14 class BookmarksUITest : public UITest { | 15 class BookmarksUITest : public UITest { |
| 15 public: | 16 public: |
| 16 BookmarksUITest() { | 17 BookmarksUITest() { |
| 17 dom_automation_enabled_ = true; | 18 dom_automation_enabled_ = true; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 success = WaitForBookmarksUI(tab); | 42 success = WaitForBookmarksUI(tab); |
| 42 EXPECT_TRUE(success); | 43 EXPECT_TRUE(success); |
| 43 if (!success) | 44 if (!success) |
| 44 return NULL; | 45 return NULL; |
| 45 return tab; | 46 return tab; |
| 46 } | 47 } |
| 47 | 48 |
| 48 void AssertIsBookmarksPage(TabProxy* tab) { | 49 void AssertIsBookmarksPage(TabProxy* tab) { |
| 49 // tab->GetCurrentURL is not up to date. | 50 // tab->GetCurrentURL is not up to date. |
| 50 GURL url; | 51 GURL url; |
| 51 std::wstring out; | 52 string16 out; |
| 52 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", | 53 ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), |
| 53 L"domAutomationController.send(location.protocol)", &out)); | 54 ASCIIToUTF16("domAutomationController.send(location.protocol)"), &out)); |
| 54 ASSERT_EQ(L"chrome-extension:", out); | 55 ASSERT_EQ(ASCIIToUTF16("chrome-extension:"), out); |
| 55 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", | 56 ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), |
| 56 L"domAutomationController.send(location.pathname)", &out)); | 57 ASCIIToUTF16("domAutomationController.send(location.pathname)"), &out)); |
| 57 ASSERT_EQ(L"/main.html", out); | 58 ASSERT_EQ(ASCIIToUTF16("/main.html"), out); |
| 58 } | 59 } |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 // http://code.google.com/p/chromium/issues/detail?id=39532 | 62 // http://code.google.com/p/chromium/issues/detail?id=39532 |
| 62 TEST_F(BookmarksUITest, FLAKY_ShouldRedirectToExtension) { | 63 TEST_F(BookmarksUITest, FLAKY_ShouldRedirectToExtension) { |
| 63 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 64 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 64 ASSERT_TRUE(browser.get()); | 65 ASSERT_TRUE(browser.get()); |
| 65 | 66 |
| 66 int tab_count = -1; | 67 int tab_count = -1; |
| 67 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 68 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 146 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 146 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 147 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
| 147 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 148 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 148 ASSERT_EQ(2, tab_count); | 149 ASSERT_EQ(2, tab_count); |
| 149 } | 150 } |
| 150 | 151 |
| 151 TEST_F(BookmarksUITest, BookmarksLoaded) { | 152 TEST_F(BookmarksUITest, BookmarksLoaded) { |
| 152 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); | 153 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); |
| 153 ASSERT_TRUE(tab.get()); | 154 ASSERT_TRUE(tab.get()); |
| 154 } | 155 } |
| OLD | NEW |