summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/printing_layout_uitest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 10:21:27 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 10:21:27 +0000
commit0e60b64fcae0a0f21982bc42e0e608c8d44b12c1 (patch)
tree5ec1f7dfc5a1955d370ef071abba840c4054271d /chrome/browser/printing/printing_layout_uitest.cc
parent80de4fa5861be1171ad502eba157570839601086 (diff)
downloadchromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.zip
chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.gz
chromium_src-0e60b64fcae0a0f21982bc42e0e608c8d44b12c1.tar.bz2
[GTTF] Miscellanous UI tests cleanups:
- use built-in timeouts instead of "inventing" them in each test case - avoid unneeded checks and operations - use automation calls more effectively - use FLAKY mark instead of DISABLED to maintain test coverage - split some tests to make the above possible TEST=UI test based BUG=39785 Review URL: http://codereview.chromium.org/1547003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/printing_layout_uitest.cc')
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc23
1 files changed, 4 insertions, 19 deletions
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 5fb1b3f..d205f7b 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/simple_thread.h"
+#include "base/test/test_file_util.h"
#include "base/win_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -49,16 +50,13 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
void PrintNowTab() {
scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
- if (!tab_proxy.get())
- return;
-
ASSERT_TRUE(tab_proxy->PrintNow());
}
// Finds the dump for the last print job and compares it to the data named
// |verification_name|. Compares the saved printed job pixels with the test
// data pixels and returns the percentage of different pixels; 0 for success,
- // ]0, 100] for failure.
+ // [0, 100] for failure.
double CompareWithResult(const std::wstring& verification_name) {
FilePath test_result(ScanFiles(verification_name));
if (test_result.value().empty()) {
@@ -118,21 +116,8 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
// Makes sure the directory exists and is empty.
void CleanupDumpDirectory() {
- // Tries to delete the dumping directory for around 10 seconds.
- for (int i = 0; i < 100 && file_util::PathExists(emf_path()); ++i) {
- // It's fine fail sometimes because of opened left over .PRN file.
- // Explanation:
- // When calling PrintNowTab(), it makes sure the page is rendered and
- // sent to the spooler. It does *not* wait for the spooler to flush the
- // job. It is completely unnecessary to wait for that. So the printer
- // may write the file too late. Since the printer holds an exclusive
- // access to the file, it can't be deleted until the printer is done.
- if (file_util::Delete(emf_path(), true)) {
- break;
- }
- PlatformThread::Sleep(100);
- }
- file_util::CreateDirectory(emf_path());
+ EXPECT_TRUE(file_util::DieFileDie(emf_path(), true));
+ EXPECT_TRUE(file_util::CreateDirectory(emf_path()));
}
// Returns if Clear Type is currently enabled.