blob: 69f12a1a59a5bdca6716f33b1e50a003719afd91 [file] [log] [blame]
// Copyright 2017 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/language/language_model_manager_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
using testing::Eq;
using testing::IsNull;
using testing::Not;
// Check that Incognito language modeling is inherited from the user's profile.
TEST(LanguageModelManagerFactoryTest, SharedWithIncognito) {
content::TestBrowserThreadBundle thread_bundle;
TestingProfile profile;
const language::LanguageModelManager* const manager =
LanguageModelManagerFactory::GetForBrowserContext(&profile);
EXPECT_THAT(manager, Not(IsNull()));
Profile* const incognito = profile.GetOffTheRecordProfile();
ASSERT_THAT(incognito, Not(IsNull()));
EXPECT_THAT(LanguageModelManagerFactory::GetForBrowserContext(incognito),
Eq(manager));
}