| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/dom_ui/new_tab_ui.h" | 10 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 L"(function() {" | 154 L"(function() {" |
| 155 L" var el = document.querySelector('#notification');" | 155 L" var el = document.querySelector('#notification');" |
| 156 L" return el.classList.contains('show');" | 156 L" return el.classList.contains('show');" |
| 157 L"})()" | 157 L"})()" |
| 158 L")", | 158 L")", |
| 159 &has_class)); | 159 &has_class)); |
| 160 ASSERT_TRUE(has_class); | 160 ASSERT_TRUE(has_class); |
| 161 | 161 |
| 162 bool is_home_page; | 162 bool is_home_page; |
| 163 ASSERT_TRUE(browser->GetBooleanPreference(prefs::kHomePageIsNewTabPage, | 163 ASSERT_TRUE(browser->GetBooleanPreference(prefs::kHomePageIsNewTabPage, |
| 164 &is_home_page)); | 164 &is_home_page)); |
| 165 ASSERT_TRUE(is_home_page); | 165 ASSERT_TRUE(is_home_page); |
| 166 } | 166 } |
| 167 |
| 168 TEST_F(NewTabUITest, PromoLink) { |
| 169 #if defined(OS_WIN) |
| 170 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 171 ASSERT_TRUE(browser.get()); |
| 172 |
| 173 // Bring up a new tab page. |
| 174 ASSERT_TRUE(browser->RunCommand(IDC_NEW_TAB)); |
| 175 int load_time; |
| 176 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
| 177 |
| 178 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 179 ASSERT_TRUE(tab.get()); |
| 180 |
| 181 // Test "import bookmarks" promo. |
| 182 bool result; |
| 183 ASSERT_TRUE(tab->ExecuteAndExtractBool(L"", |
| 184 L"window.domAutomationController.send(" |
| 185 L"(function() {" |
| 186 L" tipCache = [{\"set_promo_tip\":" |
| 187 L"\"<button class='link'>Import</button> bookmarks\"}];" |
| 188 L" renderTip();" |
| 189 L" var e = document.createEvent('Event');" |
| 190 L" e.initEvent('click', true, true);" |
| 191 L" var el = document.querySelector('#tip-line button');" |
| 192 L" el.dispatchEvent(e);" |
| 193 L" return true;" |
| 194 L"})()" |
| 195 L")", |
| 196 &result)); |
| 197 |
| 198 ASSERT_TRUE(result); |
| 199 #endif |
| 200 // TODO(mirandac): Ensure that we showed the import bookmarks dialog. |
| 201 // Remove check for OS_WIN after implemented in Mac and Linux. |
| 202 } |
| OLD | NEW |