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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/scoped_temp_dir.h" | 6 #include "base/scoped_temp_dir.h" |
7 #include "chrome/browser/download/mhtml_generation_manager.h" | 7 #include "chrome/browser/download/mhtml_generation_manager.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 10 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/test/in_process_browser_test.h" | 11 #include "chrome/test/in_process_browser_test.h" |
11 #include "chrome/test/testing_browser_process.h" | 12 #include "chrome/test/testing_browser_process.h" |
12 #include "chrome/test/ui_test_utils.h" | 13 #include "chrome/test/ui_test_utils.h" |
13 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
14 #include "net/test/test_server.h" | 15 #include "net/test/test_server.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 class MHTMLGenerationTest : public InProcessBrowserTest { | 20 class MHTMLGenerationTest : public InProcessBrowserTest { |
(...skipping 22 matching lines...) Expand all Loading... |
42 ui_test_utils::NavigateToURL(browser(), | 43 ui_test_utils::NavigateToURL(browser(), |
43 test_server()->GetURL("files/google/google.html")); | 44 test_server()->GetURL("files/google/google.html")); |
44 | 45 |
45 TabContents* tab = browser()->GetSelectedTabContentsWrapper()->tab_contents(); | 46 TabContents* tab = browser()->GetSelectedTabContentsWrapper()->tab_contents(); |
46 MHTMLGenerationManager* mhtml_generation_manager = | 47 MHTMLGenerationManager* mhtml_generation_manager = |
47 g_browser_process->mhtml_generation_manager(); | 48 g_browser_process->mhtml_generation_manager(); |
48 | 49 |
49 Source<RenderViewHost> source(tab->render_view_host()); | 50 Source<RenderViewHost> source(tab->render_view_host()); |
50 ui_test_utils::WindowedNotificationObserverWithDetails< | 51 ui_test_utils::WindowedNotificationObserverWithDetails< |
51 MHTMLGenerationManager::NotificationDetails> signal( | 52 MHTMLGenerationManager::NotificationDetails> signal( |
52 NotificationType::MHTML_GENERATED, source); | 53 chrome::NOTIFICATION_MHTML_GENERATED, source); |
53 mhtml_generation_manager->GenerateMHTML(tab, path); | 54 mhtml_generation_manager->GenerateMHTML(tab, path); |
54 signal.Wait(); | 55 signal.Wait(); |
55 | 56 |
56 MHTMLGenerationManager::NotificationDetails details; | 57 MHTMLGenerationManager::NotificationDetails details; |
57 ASSERT_TRUE(signal.GetDetailsFor(source.map_key(), &details)); | 58 ASSERT_TRUE(signal.GetDetailsFor(source.map_key(), &details)); |
58 ASSERT_TRUE(details.success); | 59 ASSERT_TRUE(details.success); |
59 | 60 |
60 // Make sure the generated file has some contents. | 61 // Make sure the generated file has some contents. |
61 int64 file_size; | 62 int64 file_size; |
62 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); | 63 ASSERT_TRUE(file_util::GetFileSize(path, &file_size)); |
63 EXPECT_GT(file_size, 100); | 64 EXPECT_GT(file_size, 100); |
64 } | 65 } |
65 | 66 |
66 } // namespace | 67 } // namespace |
OLD | NEW |