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

Side by Side Diff: chrome/browser/printing/printing_layout_browsertest.cc

Issue 10535045: TabContentsWrapper -> TabContents, for printing code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/test/test_file_util.h" 12 #include "base/test/test_file_util.h"
13 #include "base/threading/simple_thread.h" 13 #include "base/threading/simple_thread.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/printing/print_job.h" 15 #include "chrome/browser/printing/print_job.h"
16 #include "chrome/browser/printing/print_view_manager.h" 16 #include "chrome/browser/printing/print_view_manager.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
23 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/public/browser/notification_observer.h" 24 #include "content/public/browser/notification_observer.h"
25 #include "content/public/browser/notification_registrar.h" 25 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "net/test/test_server.h" 27 #include "net/test/test_server.h"
28 #include "printing/image.h" 28 #include "printing/image.h"
(...skipping 27 matching lines...) Expand all
56 56
57 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 57 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
58 command_line->AppendSwitchPath(switches::kDebugPrint, emf_path_); 58 command_line->AppendSwitchPath(switches::kDebugPrint, emf_path_);
59 } 59 }
60 60
61 protected: 61 protected:
62 void PrintNowTab() { 62 void PrintNowTab() {
63 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, 63 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
64 content::NotificationService::AllSources()); 64 content::NotificationService::AllSources());
65 65
66 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); 66 TabContents* tab = browser()->GetActiveTabContents();
67 wrapper->print_view_manager()->PrintNow(); 67 tab->print_view_manager()->PrintNow();
68 ui_test_utils::RunMessageLoop(); 68 ui_test_utils::RunMessageLoop();
69 registrar_.RemoveAll(); 69 registrar_.RemoveAll();
70 } 70 }
71 71
72 virtual void Observe(int type, 72 virtual void Observe(int type,
73 const content::NotificationSource& source, 73 const content::NotificationSource& source,
74 const content::NotificationDetails& details) { 74 const content::NotificationDetails& details) {
75 DCHECK(type == chrome::NOTIFICATION_PRINT_JOB_EVENT); 75 DCHECK(type == chrome::NOTIFICATION_PRINT_JOB_EVENT);
76 switch (content::Details<printing::JobEventDetails>(details)->type()) { 76 switch (content::Details<printing::JobEventDetails>(details)->type()) {
77 case printing::JobEventDetails::JOB_DONE: { 77 case printing::JobEventDetails::JOB_DONE: {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 // Force a navigation elsewhere to verify that it's fine with it. 454 // Force a navigation elsewhere to verify that it's fine with it.
455 url = test_server()->GetURL("files/printing/test1.html"); 455 url = test_server()->GetURL("files/printing/test1.html");
456 ui_test_utils::NavigateToURL(browser(), url); 456 ui_test_utils::NavigateToURL(browser(), url);
457 } 457 }
458 browser()->CloseWindow(); 458 browser()->CloseWindow();
459 ui_test_utils::RunAllPendingInMessageLoop(); 459 ui_test_utils::RunAllPendingInMessageLoop();
460 460
461 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; 461 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe";
462 } 462 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698