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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui_uitest.cc

Issue 7064052: Revert 88142 to fix sync_integration_tests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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
OLDNEW
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/browser/prefs/pref_value_store.h" 9 #include "chrome/browser/prefs/pref_value_store.h"
10 #include "chrome/browser/sync/signin_manager.h" 10 #include "chrome/browser/sync/signin_manager.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 ASSERT_TRUE(tab->ExecuteAndExtractString( 76 ASSERT_TRUE(tab->ExecuteAndExtractString(
77 L"", 77 L"",
78 L"window.domAutomationController.send(" 78 L"window.domAutomationController.send("
79 L"document.getElementById('login-username').innerText)", 79 L"document.getElementById('login-username').innerText)",
80 &displayed_username)); 80 &displayed_username));
81 81
82 EXPECT_EQ(L"user@gmail.com", displayed_username); 82 EXPECT_EQ(L"user@gmail.com", displayed_username);
83 } 83 }
84 84
85 // Loads chrome://hang/ into two NTP tabs, ensuring we don't crash. 85 // Loads about:hang into two NTP tabs, ensuring we don't crash.
86 // See http://crbug.com/59859. 86 // See http://crbug.com/59859.
87 TEST_F(NewTabUITest, ChromeHangInNTP) { 87 TEST_F(NewTabUITest, AboutHangInNTP) {
88 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 88 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
89 ASSERT_TRUE(window.get()); 89 ASSERT_TRUE(window.get());
90 90
91 // Bring up a new tab page. 91 // Bring up a new tab page.
92 ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); 92 ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB));
93 scoped_refptr<TabProxy> tab = window->GetActiveTab(); 93 scoped_refptr<TabProxy> tab = window->GetActiveTab();
94 ASSERT_TRUE(tab.get()); 94 ASSERT_TRUE(tab.get());
95 95
96 // Navigate to chrome://hang/ to stall the process. 96 // Navigate to about:hang to stall the process.
97 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUIHangURL))); 97 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutHangURL)));
98 98
99 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the 99 // Visit about:hang again in another NTP. Don't bother waiting for the
100 // NTP to load, because it's hung. 100 // NTP to load, because it's hung.
101 ASSERT_TRUE(window->RunCommandAsync(IDC_NEW_TAB)); 101 ASSERT_TRUE(window->RunCommandAsync(IDC_NEW_TAB));
102 scoped_refptr<TabProxy> tab2 = window->GetActiveTab(); 102 scoped_refptr<TabProxy> tab2 = window->GetActiveTab();
103 ASSERT_TRUE(tab2.get()); 103 ASSERT_TRUE(tab2.get());
104 ASSERT_TRUE(tab2->NavigateToURLAsync(GURL(chrome::kChromeUIHangURL))); 104 ASSERT_TRUE(tab2->NavigateToURLAsync(GURL(chrome::kAboutHangURL)));
105 } 105 }
106 106
107 // Allows testing NTP in process-per-tab mode. 107 // Allows testing NTP in process-per-tab mode.
108 class NewTabUIProcessPerTabTest : public NewTabUITest { 108 class NewTabUIProcessPerTabTest : public NewTabUITest {
109 public: 109 public:
110 NewTabUIProcessPerTabTest() : NewTabUITest() {} 110 NewTabUIProcessPerTabTest() : NewTabUITest() {}
111 111
112 protected: 112 protected:
113 virtual void SetUp() { 113 virtual void SetUp() {
114 launch_arguments_.AppendSwitch(switches::kProcessPerTab); 114 launch_arguments_.AppendSwitch(switches::kProcessPerTab);
115 UITest::SetUp(); 115 UITest::SetUp();
116 } 116 }
117 }; 117 };
118 118
119 // Navigates away from NTP before it commits, in process-per-tab mode. 119 // Navigates away from NTP before it commits, in process-per-tab mode.
120 // Ensures that we don't load the normal page in the NTP process (and thus 120 // Ensures that we don't load the normal page in the NTP process (and thus
121 // crash), as in http://crbug.com/69224. 121 // crash), as in http://crbug.com/69224.
122 TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { 122 TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) {
123 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 123 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
124 ASSERT_TRUE(window.get()); 124 ASSERT_TRUE(window.get());
125 125
126 // Bring up a new tab page. 126 // Bring up a new tab page.
127 ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB)); 127 ASSERT_TRUE(window->RunCommand(IDC_NEW_TAB));
128 scoped_refptr<TabProxy> tab = window->GetActiveTab(); 128 scoped_refptr<TabProxy> tab = window->GetActiveTab();
129 ASSERT_TRUE(tab.get()); 129 ASSERT_TRUE(tab.get());
130 130
131 // Navigate to chrome://hang/ to stall the process. 131 // Navigate to about:hang to stall the process.
132 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUIHangURL))); 132 ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutHangURL)));
133 133
134 // Visit a normal URL in another NTP that hasn't committed. 134 // Visit a normal URL in another NTP that hasn't committed.
135 ASSERT_TRUE(window->RunCommandAsync(IDC_NEW_TAB)); 135 ASSERT_TRUE(window->RunCommandAsync(IDC_NEW_TAB));
136 scoped_refptr<TabProxy> tab2 = window->GetActiveTab(); 136 scoped_refptr<TabProxy> tab2 = window->GetActiveTab();
137 ASSERT_TRUE(tab2.get()); 137 ASSERT_TRUE(tab2.get());
138 ASSERT_TRUE(tab2->NavigateToURL(GURL("data:text/html,hello world"))); 138 ASSERT_TRUE(tab2->NavigateToURL(GURL("data:text/html,hello world")));
139 } 139 }
140 140
141 // Fails about ~5% of the time on all platforms. http://crbug.com/45001 141 // Fails about ~5% of the time on all platforms. http://crbug.com/45001
142 TEST_F(NewTabUITest, FLAKY_ChromeInternalLoadsNTP) { 142 TEST_F(NewTabUITest, FLAKY_ChromeInternalLoadsNTP) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); 174 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion));
175 175
176 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); 176 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get());
177 ASSERT_TRUE(migrated); 177 ASSERT_TRUE(migrated);
178 ASSERT_EQ(NewTabUI::current_pref_version(), 178 ASSERT_EQ(NewTabUI::current_pref_version(),
179 prefs->GetInteger(prefs::kNTPPrefVersion)); 179 prefs->GetInteger(prefs::kNTPPrefVersion));
180 180
181 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); 181 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get());
182 ASSERT_FALSE(migrated); 182 ASSERT_FALSE(migrated);
183 } 183 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_factory.cc ('k') | chrome/browser/ui/webui/options/about_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698