Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Unified Diff: blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/engine/mojo/font_fetcher_mojo_impl.cc ('k') | blimp/engine/renderer/blimp_content_renderer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc
diff --git a/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc b/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc
deleted file mode 100644
index f7bffcecdf64b9f3fbb6b217e40b56ff70b365cc..0000000000000000000000000000000000000000
--- a/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 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 "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "blimp/engine/browser/font_data_fetcher.h"
-#include "blimp/engine/mojo/font_fetcher_mojo_impl.h"
-#include "mojo/public/cpp/system/buffer.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace blimp {
-namespace engine {
-namespace {
-
-const char kFakeHash[] = "fake hash";
-const char kTestString[] = "Hello world";
-
-class FakeFontDataFetcher : public FontDataFetcher {
- public:
- FakeFontDataFetcher() {}
-
- void FetchFontStream(const std::string& font_hash,
- const FontResponseCallback& callback) const override {
- // Return an empty stream if font_hash is empty, otherwise return a SkStream
- // which contains kTestString.
- if (font_hash.empty()) {
- callback.Run(base::MakeUnique<SkMemoryStream>());
- } else {
- callback.Run(base::MakeUnique<SkMemoryStream>(
- kTestString, arraysize(kTestString) - 1));
- }
- }
-};
-
-void VerifyEmptyDataWrite(mojo::ScopedSharedBufferHandle handle,
- uint32_t size) {
- ASSERT_FALSE(handle.is_valid());
- EXPECT_EQ(size, (uint32_t)0);
-}
-
-void VerifyDataWriteCorrectly(mojo::ScopedSharedBufferHandle handle,
- uint32_t size) {
- ASSERT_TRUE(handle.is_valid());
-
- mojo::ScopedSharedBufferMapping mapping = handle->Map(size);
- ASSERT_TRUE(mapping);
-
- std::string contents(static_cast<const char*>(mapping.get()), size);
- EXPECT_EQ(kTestString, contents);
-}
-
-class FontFetcherMojoImplUnittest : public testing::Test {
- public:
- FontFetcherMojoImplUnittest()
- : font_fetcher_mojo_impl_(new FakeFontDataFetcher()) {}
- ~FontFetcherMojoImplUnittest() override {}
-
- protected:
- base::MessageLoop message_loop_;
- FontFetcherMojoImpl font_fetcher_mojo_impl_;
-};
-
-TEST_F(FontFetcherMojoImplUnittest, VerifyWriteToDataPipe) {
- mojom::FontFetcherPtr mojo_ptr;
- font_fetcher_mojo_impl_.BindRequest(MakeRequest(&mojo_ptr));
-
- // Expect that dummy font data is written correctly to a Mojo DataPipe.
- mojo_ptr->GetFontStream(kFakeHash, base::Bind(&VerifyDataWriteCorrectly));
-
- // Expect empty handle if the font stream is empty.
- mojo_ptr->GetFontStream("", base::Bind(&VerifyEmptyDataWrite));
-}
-
-} // namespace
-} // namespace engine
-} // namespace blimp
« no previous file with comments | « blimp/engine/mojo/font_fetcher_mojo_impl.cc ('k') | blimp/engine/renderer/blimp_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698