<commit_before>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/ui/ui_layout_test.h"

#include "base/file_util.h"
#include "base/string_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/tab_proxy.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"

#if defined(OS_WIN)
static const char kPlatformName[] = "chromium-win";
#elif defined(OS_MACOSX)
static const char kPlatformName[] = "chromium-mac";
#elif defined(OS_LINUX)
static const char kPlatformName[] = "chromium-linux";
#else
#error No known OS defined
#endif

static const char kTestCompleteCookie[] = "status";

UILayoutTest::UILayoutTest()
    : UITest(), initialized_for_layout_test_(false), test_count_(0) {
}

UILayoutTest::~UILayoutTest() {
  // The deletion might fail because HTTP server process might not been
  // completely shut down yet and is still holding certain handle to it.
  // To work around this problem, we try to repeat the deletion several
  // times.
  if (!temp_test_dir_.empty()) {
    static const int kRetryNum = 10;
    static const int kRetryDelayTimeMs = 500;

    int retry_time = 0;
    for (int i = 0; i < kRetryNum; ++i) {
      file_util::Delete(temp_test_dir_, true);
      if (!file_util::DirectoryExists(temp_test_dir_))
        break;

      PlatformThread::Sleep(kRetryDelayTimeMs);
      retry_time += kRetryDelayTimeMs;
    }

    if (retry_time) {
      printf("Retrying %d ms to delete temp layout test directory.\n",
             retry_time);
    }<commit_msg>[GTTF] Use DieFileDie in UILayoutTest instead of a custom poll'n'loop.<commit_after>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/ui/ui_layout_test.h"

#include "base/file_util.h"
#include "base/string_util.h"
#include "base/test/test_file_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/tab_proxy.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"

#if defined(OS_WIN)
static const char kPlatformName[] = "chromium-win";
#elif defined(OS_MACOSX)
static const char kPlatformName[] = "chromium-mac";
#elif defined(OS_LINUX)
static const char kPlatformName[] = "chromium-linux";
#else
#error No known OS defined
#endif

static const char kTestCompleteCookie[] = "status";

UILayoutTest::UILayoutTest()
    : initialized_for_layout_test_(false),
      test_count_(0) {
}

UILayoutTest::~UILayoutTest() {
  if (!temp_test_dir_.empty()) {
    // The deletion might fail because HTTP server process might not been
    // completely shut down yet and is still holding certain handle to it.
    // To work around this problem, we try to repeat the deletion several
    // times.
    EXPECT_TRUE(file_util::DieFileDie(temp_test_dir_, true));
{'fraction_non_alphanumeric': 0.11412688031393067, 'fraction_numerical': 0.005559189012426423, 'mean_word_length': 4.32, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4490134', 'n_tokens_mistral': 1009, 'n_tokens_neox': 986, 'n_words': 294}