| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // renderer. | 49 // renderer. |
| 50 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { | 50 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { |
| 51 ASSERT_TRUE(test_server()->Start()); | 51 ASSERT_TRUE(test_server()->Start()); |
| 52 | 52 |
| 53 FilePath path(temp_dir_.path()); | 53 FilePath path(temp_dir_.path()); |
| 54 path = path.Append(FILE_PATH_LITERAL("test.mht")); | 54 path = path.Append(FILE_PATH_LITERAL("test.mht")); |
| 55 | 55 |
| 56 ui_test_utils::NavigateToURL(browser(), | 56 ui_test_utils::NavigateToURL(browser(), |
| 57 test_server()->GetURL("files/google/google.html")); | 57 test_server()->GetURL("files/google/google.html")); |
| 58 | 58 |
| 59 WebContents* tab = browser()->GetSelectedWebContents(); | 59 WebContents* web_contents = browser()->GetSelectedWebContents(); |
| 60 tab->GenerateMHTML(path, | 60 web_contents->GenerateMHTML(path, |
| 61 base::Bind(&MHTMLGenerationTest::MHTMLGenerated, this)); | 61 base::Bind(&MHTMLGenerationTest::MHTMLGenerated, |
| 62 this)); |
| 62 | 63 |
| 63 // Block until the MHTML is generated. | 64 // Block until the MHTML is generated. |
| 64 ui_test_utils::RunMessageLoop(); | 65 ui_test_utils::RunMessageLoop(); |
| 65 | 66 |
| 66 EXPECT_TRUE(mhtml_generated()); | 67 EXPECT_TRUE(mhtml_generated()); |
| 67 EXPECT_GT(file_size(), 0); | 68 EXPECT_GT(file_size(), 0); |
| 68 | 69 |
| 69 // Make sure the actual generated file has some contents. | 70 // Make sure the actual generated file has some contents. |
| 70 int64 file_size; | 71 int64 file_size; |
| 71 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); | 72 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); |
| 72 EXPECT_GT(file_size, 100); | 73 EXPECT_GT(file_size, 100); |
| 73 } | 74 } |
| 74 | 75 |
| 75 } // namespace | 76 } // namespace |
| OLD | NEW |