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

Side by Side Diff: trunk/src/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc

Issue 299273003: Revert 272587 "Remove kEnablePrintPreview now that the pdf plugi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
6 #include "base/run_loop.h" 7 #include "base/run_loop.h"
7 #include "chrome/browser/printing/print_preview_dialog_controller.h" 8 #include "chrome/browser/printing/print_preview_dialog_controller.h"
8 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/print_messages.h" 13 #include "chrome/common/print_messages.h"
12 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
13 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
17 #include "url/gurl.h" 19 #include "url/gurl.h"
18 #include "ipc/ipc_message_macros.h" 20 #include "ipc/ipc_message_macros.h"
19 21
20 using content::WebContents; 22 using content::WebContents;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 run_loop.Run(); 116 run_loop.Run();
115 } 117 }
116 118
117 WebContents* GetPrintPreviewDialog() { 119 WebContents* GetPrintPreviewDialog() {
118 printing::PrintPreviewDialogController* dialog_controller = 120 printing::PrintPreviewDialogController* dialog_controller =
119 printing::PrintPreviewDialogController::GetInstance(); 121 printing::PrintPreviewDialogController::GetInstance();
120 return dialog_controller->GetPrintPreviewForContents(initiator_); 122 return dialog_controller->GetPrintPreviewForContents(initiator_);
121 } 123 }
122 124
123 private: 125 private:
126 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
127 #if !defined(GOOGLE_CHROME_BUILD)
128 command_line->AppendSwitch(switches::kEnablePrintPreview);
129 #endif
130 }
131
124 virtual void SetUpOnMainThread() OVERRIDE { 132 virtual void SetUpOnMainThread() OVERRIDE {
125 WebContents* first_tab = 133 WebContents* first_tab =
126 browser()->tab_strip_model()->GetActiveWebContents(); 134 browser()->tab_strip_model()->GetActiveWebContents();
127 ASSERT_TRUE(first_tab); 135 ASSERT_TRUE(first_tab);
128 136
129 // Open a new tab so |cloned_tab_observer_| can see it first and attach a 137 // Open a new tab so |cloned_tab_observer_| can see it first and attach a
130 // RequestPrintPreviewObserver to it before the real 138 // RequestPrintPreviewObserver to it before the real
131 // PrintPreviewMessageHandler gets created. Thus enabling 139 // PrintPreviewMessageHandler gets created. Thus enabling
132 // RequestPrintPreviewObserver to get messages first for the purposes of 140 // RequestPrintPreviewObserver to get messages first for the purposes of
133 // this test. 141 // this test.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 browser()->tab_strip_model()->GetActiveWebContents()); 213 browser()->tab_strip_model()->GetActiveWebContents());
206 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); 214 ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed());
207 215
208 // Try printing again. 216 // Try printing again.
209 PrintPreview(); 217 PrintPreview();
210 218
211 // Create a preview dialog for the initiator tab. 219 // Create a preview dialog for the initiator tab.
212 WebContents* new_preview_dialog = GetPrintPreviewDialog(); 220 WebContents* new_preview_dialog = GetPrintPreviewDialog();
213 EXPECT_TRUE(new_preview_dialog); 221 EXPECT_TRUE(new_preview_dialog);
214 } 222 }
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/prefs/command_line_pref_store.cc ('k') | trunk/src/chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698