OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/automation/browser_proxy.h" | 9 #include "chrome/test/automation/browser_proxy.h" |
10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 scoped_refptr<TabProxy> GetBookmarksUITab() { | 27 scoped_refptr<TabProxy> GetBookmarksUITab() { |
28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 28 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
29 EXPECT_TRUE(browser.get()); | 29 EXPECT_TRUE(browser.get()); |
30 if (!browser.get()) | 30 if (!browser.get()) |
31 return NULL; | 31 return NULL; |
32 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 32 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
33 EXPECT_TRUE(tab.get()); | 33 EXPECT_TRUE(tab.get()); |
34 if (!tab.get()) | 34 if (!tab.get()) |
35 return NULL; | 35 return NULL; |
36 if (!tab->NavigateToURL(GURL(chrome::kChromeUIBookmarksURL))) | 36 bool success = tab->NavigateToURL(GURL(chrome::kChromeUIBookmarksURL)); |
| 37 EXPECT_TRUE(success); |
| 38 if (!success) |
37 return NULL; | 39 return NULL; |
38 if (!WaitForBookmarksUI(tab)) | 40 success = WaitForBookmarksUI(tab); |
| 41 EXPECT_TRUE(success); |
| 42 if (!success) |
39 return NULL; | 43 return NULL; |
40 return tab; | 44 return tab; |
41 } | 45 } |
42 | 46 |
43 void AssertIsBookmarksPage(TabProxy* tab) { | 47 void AssertIsBookmarksPage(TabProxy* tab) { |
44 // tab->GetCurrentURL is not up to date. | 48 // tab->GetCurrentURL is not up to date. |
45 GURL url; | 49 GURL url; |
46 std::wstring out; | 50 std::wstring out; |
47 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", | 51 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", |
48 L"domAutomationController.send(location.protocol)", &out)); | 52 L"domAutomationController.send(location.protocol)", &out)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 96 |
93 ASSERT_TRUE(WaitForBookmarksUI(tab)); | 97 ASSERT_TRUE(WaitForBookmarksUI(tab)); |
94 | 98 |
95 AssertIsBookmarksPage(tab); | 99 AssertIsBookmarksPage(tab); |
96 } | 100 } |
97 | 101 |
98 TEST_F(BookmarksUITest, BookmarksLoaded) { | 102 TEST_F(BookmarksUITest, BookmarksLoaded) { |
99 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); | 103 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); |
100 ASSERT_TRUE(tab.get()); | 104 ASSERT_TRUE(tab.get()); |
101 } | 105 } |
OLD | NEW |