| Index: ui/gfx/platform_font_fake.h
|
| diff --git a/ui/gfx/platform_font_fake.h b/ui/gfx/platform_font_fake.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d352f48c469cc0f3606836c9e92a6cf10c8a59bc
|
| --- /dev/null
|
| +++ b/ui/gfx/platform_font_fake.h
|
| @@ -0,0 +1,50 @@
|
| +// Copyright (c) 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.
|
| +
|
| +#ifndef UI_GFX_PLATFORM_FONT_FAKE_H_
|
| +#define UI_GFX_PLATFORM_FONT_FAKE_H_
|
| +
|
| +#include "ui/gfx/platform_font.h"
|
| +
|
| +namespace gfx {
|
| +
|
| +// Fake font class for unit tests.
|
| +class PlatformFontFake : public PlatformFont {
|
| + public:
|
| + PlatformFontFake();
|
| + PlatformFontFake(const std::string& font_name, int font_size);
|
| +
|
| + // Overridden from PlatformFont:
|
| + virtual Font DeriveFont(int size_delta, int style) const OVERRIDE;
|
| + virtual int GetHeight() const OVERRIDE;
|
| + virtual int GetBaseline() const OVERRIDE;
|
| + virtual int GetAverageCharacterWidth() const OVERRIDE;
|
| + virtual int GetStringWidth(const base::string16& text) const OVERRIDE;
|
| + virtual int GetExpectedTextWidth(int length) const OVERRIDE;
|
| + virtual int GetStyle() const OVERRIDE;
|
| + virtual std::string GetFontName() const OVERRIDE;
|
| + virtual int GetFontSize() const OVERRIDE;
|
| + virtual NativeFont GetNativeFont() const OVERRIDE;
|
| +
|
| + // Customizes the font metrics.
|
| + void SetHeight(int height);
|
| + void SetBaseline(int baseline);
|
| +
|
| + private:
|
| + // Initializes this instance.
|
| + void InitWithNameAndSize(const std::string& font_name, int font_size);
|
| +
|
| + std::string font_name_;
|
| + int font_size_;
|
| + int style_;
|
| + int height_;
|
| + int baseline_;
|
| + int average_character_width_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PlatformFontFake);
|
| +};
|
| +
|
| +} // namespace gfx
|
| +
|
| +#endif // UI_GFX_PLATFORM_FONT_FAKE_H_
|
|
|