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

Side by Side Diff: chrome/browser/ui/webui/print_preview_ui_unittest.cc

Issue 7631008: Print Preview: Add "print preview" back to about:flags; enable it by default just once. (Closed) Base URL: svn://chrome-svn/chrome/branches/782/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « chrome/browser/ui/webui/print_preview_ui_uitest.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ref_counted_memory.h" 6 #include "base/memory/ref_counted_memory.h"
7 #include "chrome/browser/printing/print_preview_tab_controller.h" 7 #include "chrome/browser/printing/print_preview_tab_controller.h"
8 #include "chrome/browser/ui/browser_list.h" 8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/webui/print_preview_ui.h" 9 #include "chrome/browser/ui/webui/print_preview_ui.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/browser_with_test_window_test.h" 11 #include "chrome/test/browser_with_test_window_test.h"
12 #include "chrome/test/testing_profile.h" 12 #include "chrome/test/testing_profile.h"
13 #include "content/browser/tab_contents/tab_contents.h" 13 #include "content/browser/tab_contents/tab_contents.h"
14 14
15 namespace { 15 namespace {
16 16
17 const unsigned char blob1[] = 17 const unsigned char blob1[] =
18 "12346102356120394751634516591348710478123649165419234519234512349134"; 18 "12346102356120394751634516591348710478123649165419234519234512349134";
19 19
20 } // namespace 20 } // namespace
21 21
22 typedef BrowserWithTestWindowTest PrintPreviewUITest; 22 typedef BrowserWithTestWindowTest PrintPreviewUITest;
23 23
24 // Create/Get a preview tab for initiator tab. 24 // Create/Get a preview tab for initiator tab.
25 TEST_F(PrintPreviewUITest, PrintPreviewData) { 25 TEST_F(PrintPreviewUITest, PrintPreviewData) {
26 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
27 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); 26 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview);
28 #endif
29 ASSERT_TRUE(browser()); 27 ASSERT_TRUE(browser());
30 BrowserList::SetLastActive(browser()); 28 BrowserList::SetLastActive(browser());
31 ASSERT_TRUE(BrowserList::GetLastActive()); 29 ASSERT_TRUE(BrowserList::GetLastActive());
32 30
33 browser()->NewTab(); 31 browser()->NewTab();
34 TabContents* initiator_tab = browser()->GetSelectedTabContents(); 32 TabContents* initiator_tab = browser()->GetSelectedTabContents();
35 ASSERT_TRUE(initiator_tab); 33 ASSERT_TRUE(initiator_tab);
36 34
37 scoped_refptr<printing::PrintPreviewTabController> 35 scoped_refptr<printing::PrintPreviewTabController>
38 controller(new printing::PrintPreviewTabController()); 36 controller(new printing::PrintPreviewTabController());
(...skipping 18 matching lines...) Expand all
57 55
58 preview_ui->SetPrintPreviewData(dummy_data.get()); 56 preview_ui->SetPrintPreviewData(dummy_data.get());
59 preview_ui->GetPrintPreviewData(&data); 57 preview_ui->GetPrintPreviewData(&data);
60 EXPECT_EQ(dummy_data->size(), data->size()); 58 EXPECT_EQ(dummy_data->size(), data->size());
61 EXPECT_EQ(dummy_data.get(), data.get()); 59 EXPECT_EQ(dummy_data.get(), data.get());
62 60
63 // This should not cause any memory leaks. 61 // This should not cause any memory leaks.
64 dummy_data = new RefCountedBytes(); 62 dummy_data = new RefCountedBytes();
65 preview_ui->SetPrintPreviewData(dummy_data); 63 preview_ui->SetPrintPreviewData(dummy_data);
66 } 64 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_ui_uitest.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698