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

Unified Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk_unittest.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
Index: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk_unittest.cc
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk_unittest.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk_unittest.cc
deleted file mode 100644
index 1b2bd5e534a704cee2b3ba20371f07e779583863..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk_unittest.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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/ui/gtk/omnibox/omnibox_view_gtk.h"
-
-#include <gtk/gtk.h>
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/autocomplete/autocomplete_match.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
-#include "chrome/test/base/testing_profile.h"
-#include "content/public/test/test_browser_thread.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/platform_test.h"
-#include "ui/base/gtk/gtk_hig_constants.h"
-#include "ui/gfx/image/image.h"
-
-namespace {
-class OmniboxEditControllerMock : public OmniboxEditController {
- public:
- OmniboxEditControllerMock() : OmniboxEditController(NULL) {}
- virtual ~OmniboxEditControllerMock() {}
-
- MOCK_METHOD1(Update, void(const content::WebContents* contents));
- MOCK_METHOD0(OnChanged, void());
- MOCK_METHOD0(OnSetFocus, void());
- MOCK_METHOD0(ShowURL, void());
- MOCK_METHOD0(GetInstant, InstantController*());
- MOCK_METHOD0(GetWebContents, content::WebContents*());
- MOCK_METHOD0(GetToolbarModel, ToolbarModel*());
- MOCK_CONST_METHOD0(GetToolbarModel, ToolbarModel*());
- MOCK_METHOD0(HideURL, void());
-};
-} // namespace
-
-class OmniboxViewGtkTest : public PlatformTest {
- public:
- OmniboxViewGtkTest() : file_thread_(content::BrowserThread::UI) {}
-
- virtual void SetUp() {
- PlatformTest::SetUp();
- profile_.reset(new TestingProfile);
- window_ = gtk_window_new(GTK_WINDOW_POPUP);
- controller_.reset(new OmniboxEditControllerMock);
- view_.reset(new OmniboxViewGtk(controller_.get(), NULL, profile_.get(),
- NULL, false, window_));
- view_->Init();
- text_buffer_ = view_->text_buffer_;
- }
-
- virtual void TearDown() {
- gtk_widget_destroy(window_);
- PlatformTest::TearDown();
- }
-
- void SetPasteClipboardRequested(bool b) {
- view_->paste_clipboard_requested_ = b;
- }
-
- scoped_ptr<OmniboxEditControllerMock> controller_;
- scoped_ptr<TestingProfile> profile_;
- GtkTextBuffer* text_buffer_;
- scoped_ptr<OmniboxViewGtk> view_;
- GtkWidget* window_;
- content::TestBrowserThread file_thread_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OmniboxViewGtkTest);
-};
-
-TEST_F(OmniboxViewGtkTest, InsertText) {
- GtkTextIter i;
- const char input[] = " hello, world ";
- const std::string expected = input;
- gtk_text_buffer_get_iter_at_offset(text_buffer_, &i, 0);
- gtk_text_buffer_insert(text_buffer_, &i, input, strlen(input));
- ASSERT_EQ(expected, base::UTF16ToUTF8(view_->GetText()));
-}
-
-TEST_F(OmniboxViewGtkTest, PasteText) {
- GtkTextIter i;
- const char input[] = " hello, world ";
- const std::string expected = "hello, world";
- SetPasteClipboardRequested(true);
- view_->OnBeforePossibleChange();
- gtk_text_buffer_get_iter_at_offset(text_buffer_, &i, 0);
- gtk_text_buffer_insert(text_buffer_, &i, input, strlen(input));
-
- ASSERT_EQ(expected, base::UTF16ToUTF8(view_->GetText()));
-}

Powered by Google App Engine
This is Rietveld 408576698