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

Side by Side Diff: content/test/layout_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « content/test/DEPS ('k') | no next file » | 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) 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"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/layout_test_http_server.h" 18 #include "chrome/test/base/layout_test_http_server.h"
18 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/browser/web_contents/web_contents_impl.h" 20 #include "content/browser/web_contents/web_contents_impl.h"
20 #include "content/public/common/content_paths.h" 21 #include "content/public/common/content_paths.h"
21 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
22 23
23 #if defined(OS_WIN) 24 #if defined(OS_WIN)
24 static const char kPlatformName[] = "chromium-win"; 25 static const char kPlatformName[] = "chromium-win";
25 #elif defined(OS_MACOSX) 26 #elif defined(OS_MACOSX)
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(), 181 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(),
181 test_case_file_name.c_str())); 182 test_case_file_name.c_str()));
182 RunLayoutTestInternal(test_case_file_name, url); 183 RunLayoutTestInternal(test_case_file_name, url);
183 } 184 }
184 185
185 void InProcessBrowserLayoutTest::RunLayoutTestInternal( 186 void InProcessBrowserLayoutTest::RunLayoutTestInternal(
186 const std::string& test_case_file_name, const GURL& url) { 187 const std::string& test_case_file_name, const GURL& url) {
187 LOG(INFO) << "Navigating to URL " << url << " and blocking."; 188 LOG(INFO) << "Navigating to URL " << url << " and blocking.";
188 const string16 expected_title = ASCIIToUTF16("done"); 189 const string16 expected_title = ASCIIToUTF16("done");
189 ui_test_utils::TitleWatcher title_watcher( 190 ui_test_utils::TitleWatcher title_watcher(
190 browser()->GetActiveWebContents(), expected_title); 191 chrome::GetActiveWebContents(browser()), expected_title);
191 ui_test_utils::NavigateToURL(browser(), url); 192 ui_test_utils::NavigateToURL(browser(), url);
192 LOG(INFO) << "Navigation completed, now waiting for title."; 193 LOG(INFO) << "Navigation completed, now waiting for title.";
193 string16 final_title = title_watcher.WaitAndGetTitle(); 194 string16 final_title = title_watcher.WaitAndGetTitle();
194 EXPECT_EQ(expected_title, final_title); 195 EXPECT_EQ(expected_title, final_title);
195 196
196 std::string actual_text; 197 std::string actual_text;
197 ScrapeResultFromBrowser(browser(), &actual_text); 198 ScrapeResultFromBrowser(browser(), &actual_text);
198 ReplaceSubstringsAfterOffset(&actual_text, 0, "\r", ""); 199 ReplaceSubstringsAfterOffset(&actual_text, 0, "\r", "");
199 TrimString(actual_text, "\n", &actual_text); 200 TrimString(actual_text, "\n", &actual_text);
200 201
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ASSERT_TRUE(file_util::ReadFileToString(path_to_single_test, &test_html)); 254 ASSERT_TRUE(file_util::ReadFileToString(path_to_single_test, &test_html));
254 255
255 size_t insertion_position = FindInsertPosition(test_html); 256 size_t insertion_position = FindInsertPosition(test_html);
256 test_html.insert(insertion_position, preamble); 257 test_html.insert(insertion_position, preamble);
257 *test_path = our_layout_test_temp_dir_.Append(test_case_dir_); 258 *test_path = our_layout_test_temp_dir_.Append(test_case_dir_);
258 *test_path = test_path->AppendASCII(test_case_file_name); 259 *test_path = test_path->AppendASCII(test_case_file_name);
259 ASSERT_TRUE(file_util::WriteFile(*test_path, 260 ASSERT_TRUE(file_util::WriteFile(*test_path,
260 &test_html.at(0), 261 &test_html.at(0),
261 static_cast<int>(test_html.size()))); 262 static_cast<int>(test_html.size())));
262 } 263 }
OLDNEW
« no previous file with comments | « content/test/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698