blob: a817174fda015212d81880daaf3495de5c70ac61 [file] [log] [blame]
// Copyright 2013 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/search/instant_service.h"
#include <vector>
#include "chrome/browser/search/instant_unittest_base.h"
#include "chrome/common/search/instant_types.h"
#include "components/ntp_tiles/ntp_tile.h"
#include "components/ntp_tiles/section_type.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
using InstantServiceTest = InstantUnitTestBase;
TEST_F(InstantServiceTest, GetNTPTileSuggestion) {
ntp_tiles::NTPTile some_tile;
some_tile.source = ntp_tiles::TileSource::TOP_SITES;
some_tile.title_source = ntp_tiles::TileTitleSource::TITLE_TAG;
ntp_tiles::NTPTilesVector suggestions{some_tile};
std::map<ntp_tiles::SectionType, ntp_tiles::NTPTilesVector> suggestions_map;
suggestions_map[ntp_tiles::SectionType::PERSONALIZED] = suggestions;
instant_service_->OnURLsAvailable(suggestions_map);
auto items = instant_service_->most_visited_items_;
ASSERT_EQ(1, (int)items.size());
EXPECT_EQ(ntp_tiles::TileSource::TOP_SITES, items[0].source);
EXPECT_EQ(ntp_tiles::TileTitleSource::TITLE_TAG, items[0].title_source);
}