OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/test/layout_browsertest.h" | 5 #include "content/test/layout_browsertest.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(), | 179 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(), |
180 test_case_file_name.c_str())); | 180 test_case_file_name.c_str())); |
181 RunLayoutTestInternal(test_case_file_name, url); | 181 RunLayoutTestInternal(test_case_file_name, url); |
182 } | 182 } |
183 | 183 |
184 void InProcessBrowserLayoutTest::RunLayoutTestInternal( | 184 void InProcessBrowserLayoutTest::RunLayoutTestInternal( |
185 const std::string& test_case_file_name, const GURL& url) { | 185 const std::string& test_case_file_name, const GURL& url) { |
186 LOG(INFO) << "Navigating to URL " << url << " and blocking."; | 186 LOG(INFO) << "Navigating to URL " << url << " and blocking."; |
187 const string16 expected_title = ASCIIToUTF16("done"); | 187 const string16 expected_title = ASCIIToUTF16("done"); |
188 ui_test_utils::TitleWatcher title_watcher( | 188 ui_test_utils::TitleWatcher title_watcher( |
189 browser()->GetSelectedWebContents(), expected_title); | 189 browser()->GetActiveWebContents(), expected_title); |
190 ui_test_utils::NavigateToURL(browser(), url); | 190 ui_test_utils::NavigateToURL(browser(), url); |
191 LOG(INFO) << "Navigation completed, now waiting for title."; | 191 LOG(INFO) << "Navigation completed, now waiting for title."; |
192 string16 final_title = title_watcher.WaitAndGetTitle(); | 192 string16 final_title = title_watcher.WaitAndGetTitle(); |
193 EXPECT_EQ(expected_title, final_title); | 193 EXPECT_EQ(expected_title, final_title); |
194 | 194 |
195 std::string actual_text; | 195 std::string actual_text; |
196 ScrapeResultFromBrowser(browser(), &actual_text); | 196 ScrapeResultFromBrowser(browser(), &actual_text); |
197 ReplaceSubstringsAfterOffset(&actual_text, 0, "\r", ""); | 197 ReplaceSubstringsAfterOffset(&actual_text, 0, "\r", ""); |
198 TrimString(actual_text, "\n", &actual_text); | 198 TrimString(actual_text, "\n", &actual_text); |
199 | 199 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 ASSERT_TRUE(file_util::ReadFileToString(path_to_single_test, &test_html)); | 252 ASSERT_TRUE(file_util::ReadFileToString(path_to_single_test, &test_html)); |
253 | 253 |
254 size_t insertion_position = FindInsertPosition(test_html); | 254 size_t insertion_position = FindInsertPosition(test_html); |
255 test_html.insert(insertion_position, preamble); | 255 test_html.insert(insertion_position, preamble); |
256 *test_path = our_layout_test_temp_dir_.Append(test_case_dir_); | 256 *test_path = our_layout_test_temp_dir_.Append(test_case_dir_); |
257 *test_path = test_path->AppendASCII(test_case_file_name); | 257 *test_path = test_path->AppendASCII(test_case_file_name); |
258 ASSERT_TRUE(file_util::WriteFile(*test_path, | 258 ASSERT_TRUE(file_util::WriteFile(*test_path, |
259 &test_html.at(0), | 259 &test_html.at(0), |
260 static_cast<int>(test_html.size()))); | 260 static_cast<int>(test_html.size()))); |
261 } | 261 } |
OLD | NEW |