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 "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/browser/ui/browser_tabstrip.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "net/test/test_server.h" | 14 #include "net/test/test_server.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 using content::WebContents; | 17 using content::WebContents; |
17 | 18 |
18 namespace { | 19 namespace { |
(...skipping 30 matching lines...) Expand all Loading... |
49 // renderer. | 50 // renderer. |
50 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { | 51 IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { |
51 ASSERT_TRUE(test_server()->Start()); | 52 ASSERT_TRUE(test_server()->Start()); |
52 | 53 |
53 FilePath path(temp_dir_.path()); | 54 FilePath path(temp_dir_.path()); |
54 path = path.Append(FILE_PATH_LITERAL("test.mht")); | 55 path = path.Append(FILE_PATH_LITERAL("test.mht")); |
55 | 56 |
56 ui_test_utils::NavigateToURL(browser(), | 57 ui_test_utils::NavigateToURL(browser(), |
57 test_server()->GetURL("files/google/google.html")); | 58 test_server()->GetURL("files/google/google.html")); |
58 | 59 |
59 WebContents* web_contents = browser()->GetActiveWebContents(); | 60 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
60 web_contents->GenerateMHTML(path, | 61 web_contents->GenerateMHTML(path, |
61 base::Bind(&MHTMLGenerationTest::MHTMLGenerated, | 62 base::Bind(&MHTMLGenerationTest::MHTMLGenerated, |
62 this)); | 63 this)); |
63 | 64 |
64 // Block until the MHTML is generated. | 65 // Block until the MHTML is generated. |
65 ui_test_utils::RunMessageLoop(); | 66 ui_test_utils::RunMessageLoop(); |
66 | 67 |
67 EXPECT_TRUE(mhtml_generated()); | 68 EXPECT_TRUE(mhtml_generated()); |
68 EXPECT_GT(file_size(), 0); | 69 EXPECT_GT(file_size(), 0); |
69 | 70 |
70 // Make sure the actual generated file has some contents. | 71 // Make sure the actual generated file has some contents. |
71 int64 file_size; | 72 int64 file_size; |
72 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); | 73 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); |
73 EXPECT_GT(file_size, 100); | 74 EXPECT_GT(file_size, 100); |
74 } | 75 } |
75 | 76 |
76 } // namespace | 77 } // namespace |
OLD | NEW |