<commit_before>// Copyright (c) 2010 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/browser/dom_ui/shown_sections_handler.h"

#include "base/scoped_ptr.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"

class ShownSectionsHandlerTest : public testing::Test {
};

// http://crbug.com/53405
TEST_F(ShownSectionsHandlerTest, DISABLED_MigrateUserPrefs) {
  scoped_ptr<PrefService> pref(new TestingPrefService);

  // Set an *old* value
  pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
  pref->SetInteger(prefs::kNTPShownSections, THUMB);

  ShownSectionsHandler::MigrateUserPrefs(pref.get(), 0, 1);

  int shown_sections = pref->GetInteger(prefs::kNTPShownSections);

  EXPECT_TRUE(shown_sections & THUMB);
  EXPECT_FALSE(shown_sections & LIST);
  EXPECT_FALSE(shown_sections & RECENT);
  EXPECT_TRUE(shown_sections & TIPS);
  EXPECT_TRUE(shown_sections & SYNC);
}

// http://crbug.com/53405
TEST_F(ShownSectionsHandlerTest, DISABLED_MigrateUserPrefs1To2) {
  scoped_ptr<PrefService> pref(new TestingPrefService);

  // Set an *old* value
  pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
  pref->SetInteger(prefs::kNTPShownSections, LIST);

  ShownSectionsHandler::MigrateUserPrefs(pref.get(), 1, 2);

  int shown_sections = pref->GetInteger(prefs::kNTPShownSections);

  EXPECT_TRUE(shown_sections & THUMB);
  EXPECT_FALSE(shown_sections & LIST);
}<commit_msg>Re-enable 2 uni_tests. They started passing again after a revert.<commit_after>// Copyright (c) 2010 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/browser/dom_ui/shown_sections_handler.h"

#include "base/scoped_ptr.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"

class ShownSectionsHandlerTest : public testing::Test {
};

TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs) {
  scoped_ptr<PrefService> pref(new TestingPrefService);

  // Set an *old* value
  pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
  pref->SetInteger(prefs::kNTPShownSections, THUMB);

  ShownSectionsHandler::MigrateUserPrefs(pref.get(), 0, 1);

  int shown_sections = pref->GetInteger(prefs::kNTPShownSections);

  EXPECT_TRUE(shown_sections & THUMB);
  EXPECT_FALSE(shown_sections & LIST);
  EXPECT_FALSE(shown_sections & RECENT);
  EXPECT_TRUE(shown_sections & TIPS);
  EXPECT_TRUE(shown_sections & SYNC);
}

TEST_F(ShownSectionsHandlerTest, MigrateUserPrefs1To2) {
  scoped_ptr<PrefService> pref(new TestingPrefService);

  // Set an *old* value
  pref->RegisterIntegerPref(prefs::kNTPShownSections, 0);
  pref->SetInteger(prefs::kNTPShownSections, LIST);

  ShownSectionsHandler::MigrateUserPrefs(pref.get(), 1, 2);

  int shown_sections = pref->GetInteger(prefs::kNTPShownSections);

  EXPECT_TRUE(shown_sections & THUMB);
  EXPECT_FALSE(shown_sections & LIST);
}
{'fraction_non_alphanumeric': 0.12001173708920188, 'fraction_numerical': 0.010269953051643193, 'mean_word_length': 6.268656716417911, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '3952232', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1203, 'n_words': 213}