Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui_uitest.cc

Issue 3036024: Revert import bookmarks tip and bookmark bar removal on NTP (Merge of r53804 ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/dom_ui/tips_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); 92 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get());
93 ASSERT_TRUE(migrated); 93 ASSERT_TRUE(migrated);
94 ASSERT_EQ(NewTabUI::current_pref_version(), 94 ASSERT_EQ(NewTabUI::current_pref_version(),
95 prefs->GetInteger(prefs::kNTPPrefVersion)); 95 prefs->GetInteger(prefs::kNTPPrefVersion));
96 96
97 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); 97 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get());
98 ASSERT_FALSE(migrated); 98 ASSERT_FALSE(migrated);
99 } 99 }
100 100
101 TEST_F(NewTabUITest, HomePageLink) {
102 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
103 ASSERT_TRUE(browser.get());
104
105 ASSERT_TRUE(
106 browser->SetBooleanPreference(prefs::kHomePageIsNewTabPage, false));
107
108 // Bring up a new tab page.
109 ASSERT_TRUE(browser->RunCommand(IDC_NEW_TAB));
110 int load_time;
111 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time));
112
113 scoped_refptr<TabProxy> tab = browser->GetActiveTab();
114 ASSERT_TRUE(tab.get());
115
116 // TODO(arv): Extract common patterns for doing js testing.
117
118 // Fire click. Because tip service is turned off for testing, we first
119 // force the "make this my home page" tip to appear.
120 // TODO(arv): Find screen position of element and use a lower level click
121 // emulation.
122 bool result;
123 ASSERT_TRUE(tab->ExecuteAndExtractBool(L"",
124 L"window.domAutomationController.send("
125 L"(function() {"
126 L" tipCache = [{\"set_homepage_tip\":\"Make this the home page\"}];"
127 L" renderTip();"
128 L" var e = document.createEvent('Event');"
129 L" e.initEvent('click', true, true);"
130 L" var el = document.querySelector('#tip-line > button');"
131 L" el.dispatchEvent(e);"
132 L" return true;"
133 L"})()"
134 L")",
135 &result));
136 ASSERT_TRUE(result);
137
138 // Make sure text of "set as home page" tip has been removed.
139 std::wstring tip_text_content;
140 ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
141 L"window.domAutomationController.send("
142 L"(function() {"
143 L" var el = document.querySelector('#tip-line');"
144 L" return el.textContent;"
145 L"})()"
146 L")",
147 &tip_text_content));
148 ASSERT_EQ(L"", tip_text_content);
149
150 // Make sure that the notification is visible
151 bool has_class;
152 ASSERT_TRUE(tab->ExecuteAndExtractBool(L"",
153 L"window.domAutomationController.send("
154 L"(function() {"
155 L" var el = document.querySelector('#notification');"
156 L" return el.classList.contains('show');"
157 L"})()"
158 L")",
159 &has_class));
160 ASSERT_TRUE(has_class);
161
162 bool is_home_page;
163 ASSERT_TRUE(browser->GetBooleanPreference(prefs::kHomePageIsNewTabPage,
164 &is_home_page));
165 ASSERT_TRUE(is_home_page);
166 }
167
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/dom_ui/tips_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698