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

Side by Side Diff: chrome/browser/browser_encoding_browsertest.cc

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "chrome/browser/character_encoding.h" 8 #include "chrome/browser/character_encoding.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // Saves the current page and verifies that the output matches the expected 35 // Saves the current page and verifies that the output matches the expected
36 // result. 36 // result.
37 void SaveAndCompare(const char* filename_to_write, const FilePath& expected) { 37 void SaveAndCompare(const char* filename_to_write, const FilePath& expected) {
38 // Dump the page, the content of dump page should be identical to the 38 // Dump the page, the content of dump page should be identical to the
39 // expected result file. 39 // expected result file.
40 FilePath full_file_name = save_dir_.AppendASCII(filename_to_write); 40 FilePath full_file_name = save_dir_.AppendASCII(filename_to_write);
41 // We save the page as way of complete HTML file, which requires a directory 41 // We save the page as way of complete HTML file, which requires a directory
42 // name to save sub resources in it. Although this test file does not have 42 // name to save sub resources in it. Although this test file does not have
43 // sub resources, but the directory name is still required. 43 // sub resources, but the directory name is still required.
44 ui_test_utils::WindowedNotificationObserver observer( 44 content::WindowedNotificationObserver observer(
45 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, 45 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
46 content::NotificationService::AllSources()); 46 content::NotificationService::AllSources());
47 chrome::GetActiveWebContents(browser())->SavePage( 47 chrome::GetActiveWebContents(browser())->SavePage(
48 full_file_name, temp_sub_resource_dir_, 48 full_file_name, temp_sub_resource_dir_,
49 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); 49 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML);
50 observer.Wait(); 50 observer.Wait();
51 51
52 FilePath expected_file_name = ui_test_utils::GetTestFilePath( 52 FilePath expected_file_name = ui_test_utils::GetTestFilePath(
53 FilePath(kTestDir), expected); 53 FilePath(kTestDir), expected);
54 54
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); 289 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding());
290 290
291 // Dump the page, the content of dump page should be equal with our expect 291 // Dump the page, the content of dump page should be equal with our expect
292 // result file. 292 // result file.
293 FilePath expected_result_file_name = 293 FilePath expected_result_file_name =
294 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). 294 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir).
295 AppendASCII(kTestDatas[i].expected_result); 295 AppendASCII(kTestDatas[i].expected_result);
296 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); 296 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name);
297 } 297 }
298 } 298 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_popup_view_browsertest.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698