chromium/chrome/renderer/searchbox/searchbox_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/renderer/searchbox/searchbox.h"

#include <stddef.h>

#include <map>
#include <string>

#include "chrome/common/search/instant_types.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace {

const char* kUrlString1 =;
const char* kUrlString2 =;
const char* kUrlString3 =;

// Mock helper to test internal::TranslateIconRestrictedUrl().
class MockIconURLHelper: public SearchBox::IconURLHelper {};

MockIconURLHelper::MockIconURLHelper() {}

MockIconURLHelper::~MockIconURLHelper() {}

std::string MockIconURLHelper::GetMainFrameToken() const {}

std::string MockIconURLHelper::GetURLStringFromRestrictedID(
    InstantRestrictedID rid) const {}

}  // namespace

namespace internal {

// Defined in searchbox.cc
bool ParseFrameTokenAndRestrictedId(const std::string& id_part,
                                    std::string* frame_token_out,
                                    InstantRestrictedID* rid_out);

// Defined in searchbox.cc
bool ParseIconRestrictedUrl(const GURL& url,
                            std::string* param_part,
                            std::string* frame_token,
                            InstantRestrictedID* rid);

// Defined in searchbox.cc
void TranslateIconRestrictedUrl(const GURL& transient_url,
                                const SearchBox::IconURLHelper& helper,
                                GURL* url);

TEST(SearchBoxUtilTest, ParseFrameTokenAndRestrictedIdSuccess) {}

TEST(SearchBoxUtilTest, ParseFrameIdAndRestrictedIdFailure) {}

TEST(SearchBoxUtilTest, ParseIconRestrictedUrlFaviconSuccess) {}

TEST(SearchBoxUtilTest, ParseIconRestrictedUrlFailure) {}

TEST(SearchBoxUtilTest, TranslateIconRestrictedUrlSuccess) {}

}  // namespace internal