chromium/components/omnibox/browser/location_bar_model_impl_unittest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/omnibox/browser/location_bar_model_impl.h"

#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/dom_distiller/core/url_utils.h"
#include "components/omnibox/browser/location_bar_model_delegate.h"
#include "components/omnibox/browser/test_omnibox_client.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/omnibox/common/omnibox_focus_state.h"
#include "components/search_engines/template_url_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/paint_vector_icon.h"
#include "url/gurl.h"
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#include "components/omnibox/browser/vector_icons.h"  // nogncheck
#include "components/vector_icons/vector_icons.h"     // nogncheck
#endif

OmniboxEventProto;
_;
Invoke;
Return;
WithArg;

namespace {

class TestLocationBarModelDelegate : public LocationBarModelDelegate {};

class MockLocationBarModelDelegate
    : public testing::NiceMock<TestLocationBarModelDelegate> {};

class LocationBarModelImplTest : public testing::Test {};

TEST_F(LocationBarModelImplTest, FormatsReaderModeUrls) {}

// TODO(crbug.com/40651107): Fix flakes on linux_chromium_asan_rel_ng and
// re-enable this test.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_PreventElisionWorks
#else
#define MAYBE_PreventElisionWorks
#endif
TEST_F(LocationBarModelImplTest, MAYBE_PreventElisionWorks) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
// Tests GetVectorIcon returns the correct security indicator icon.
TEST_F(LocationBarModelImplTest, GetVectorIcon) {}
#endif  // !BUILDFLAG(IS_IOS)

#if BUILDFLAG(IS_IOS)

// Test that blob:http://example.test/foobar is displayed as "example.test" on
// iOS.
TEST_F(LocationBarModelImplTest, BlobDisplayURLIOS) {
  delegate()->SetURL(GURL("blob:http://example.test/foo"));
  EXPECT_EQ(u"example.test/TestSuffix", model()->GetURLForDisplay());
}

#endif  // BUILDFLAG(IS_IOS)

// Test that the expected page classification is returned.
TEST_F(LocationBarModelImplTest, GetPageClassification) {}

}  // namespace