Skip to content

Commit

Permalink
Revert 220467 "Added basic browser test for window.print() from ..."
Browse files Browse the repository at this point in the history
> Added basic browser test for window.print() from Chrome apps.
> 
> This just tests the success of the call to window.print(). It does not
> test whether the call leads to a print preview window and ultimately to
> a printout. It will be extended over time to provide additional coverage
> of the print functionality.
> 
> BUG=NONE
> 
> Review URL: https://chromiumcodereview.appspot.com/23054002

TBR=dharcourt@chromium.org

Review URL: https://codereview.chromium.org/23597011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220472 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dharcourt@chromium.org committed Aug 30, 2013
1 parent c669a81 commit 85267b1
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 88 deletions.
30 changes: 0 additions & 30 deletions chrome/browser/apps/app_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/app_runtime.h"
#include "chrome/common/pref_names.h"
Expand Down Expand Up @@ -1037,35 +1036,6 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
GetRenderWidgetHostView()->HasFocus());
}

class PlatformAppPrintBrowserTest : public extensions::PlatformAppBrowserTest {
public:
PlatformAppPrintBrowserTest() {}

// Ensures print tests use the print preview panel even for non-Chrome
// branded Chromium builds.
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kEnablePrintPreview);
PlatformAppBrowserTest::SetUpCommandLine(command_line);
}
};

// Currently this test only works if the PDF preview plug-in is available. This
// plug-in will only be available in Chrome release builds or if it has been
// manually copied from a Chrome release build. To run this test when the
// plug-in has been manually copied, manually comment out the next three lines
// and the corresponding #endif.
#if !defined(GOOGLE_CHROME_BUILD)
#define MAYBE_WindowDotPrintWorks DISABLED_WindowDotPrintWorks
#else
#define MAYBE_WindowDotPrintWorks WindowDotPrintWorks
#endif

IN_PROC_BROWSER_TEST_F(PlatformAppPrintBrowserTest, MAYBE_WindowDotPrintWorks) {
PrintPreviewUI::SetAutoCancelForTesting(true);
ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_;
PrintPreviewUI::SetAutoCancelForTesting(false);
}


#if defined(OS_CHROMEOS)

Expand Down
18 changes: 2 additions & 16 deletions chrome/browser/ui/webui/print_preview/print_preview_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,8 @@ void PrintPreviewUI::OnPreviewDataIsAvailable(int expected_pages_count,
}
base::FundamentalValue ui_identifier(id_);
base::FundamentalValue ui_preview_request_id(preview_request_id);
if (AutoCancelForTesting()) {
OnClosePrintPreviewDialog();
} else {
web_ui()->CallJavascriptFunction("updatePrintPreview", ui_identifier,
ui_preview_request_id);
}
web_ui()->CallJavascriptFunction("updatePrintPreview", ui_identifier,
ui_preview_request_id);
}

void PrintPreviewUI::OnPrintPreviewDialogDestroyed() {
Expand Down Expand Up @@ -586,13 +582,3 @@ void PrintPreviewUI::OnReloadPrintersList() {
void PrintPreviewUI::OnPrintPreviewScalingDisabled() {
web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF");
}

static bool g_auto_cancel_for_testing_ = false;

void PrintPreviewUI::SetAutoCancelForTesting(bool auto_cancel) {
g_auto_cancel_for_testing_ = auto_cancel;
}

bool PrintPreviewUI::AutoCancelForTesting() {
return g_auto_cancel_for_testing_;
}
4 changes: 0 additions & 4 deletions chrome/browser/ui/webui/print_preview/print_preview_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ class PrintPreviewUI : public ConstrainedWebDialogUI {
// default.
void OnPrintPreviewScalingDisabled();

// Manages the global auto-cancel mode used only for testing.
static void SetAutoCancelForTesting(bool auto_cancel);
static bool AutoCancelForTesting();

private:
friend class PrintPreviewHandlerTest;
FRIEND_TEST_ALL_PREFIXES(PrintPreviewHandlerTest, StickyMarginsCustom);
Expand Down
11 changes: 0 additions & 11 deletions chrome/test/data/extensions/platform_apps/print_api/manifest.json

This file was deleted.

10 changes: 0 additions & 10 deletions chrome/test/data/extensions/platform_apps/print_api/test.html

This file was deleted.

17 changes: 0 additions & 17 deletions chrome/test/data/extensions/platform_apps/print_api/test.js

This file was deleted.

0 comments on commit 85267b1

Please sign in to comment.