Remove Chromium includes in unit tests (issue #1632)

This commit is contained in:
Marshall Greenblatt 2016-11-15 18:22:34 -05:00
parent 0e65f027d2
commit ef6df50bf9
5 changed files with 26 additions and 14 deletions

View File

@ -2,6 +2,7 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/base/cef_bind.h"
#include "include/views/cef_button.h"
#include "include/views/cef_button_delegate.h"
#include "include/views/cef_label_button.h"
@ -12,7 +13,6 @@
#include "tests/unittests/thread_helper.h"
#include "tests/unittests/views/test_window_delegate.h"
#include "base/bind.h"
#include "testing/gtest/include/gtest/gtest.h"
#define BUTTON_TEST(name) UI_THREAD_TEST(ViewsButtonTest, name)

View File

@ -2,6 +2,7 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/base/cef_bind.h"
#include "include/cef_pack_strings.h"
#include "include/views/cef_panel.h"
#include "include/views/cef_panel_delegate.h"
@ -10,7 +11,6 @@
#include "tests/unittests/thread_helper.h"
#include "tests/unittests/views/test_window_delegate.h"
#include "base/bind.h"
#include "testing/gtest/include/gtest/gtest.h"
#define SCROLL_VIEW_TEST_ASYNC(name) \

View File

@ -2,13 +2,12 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/base/cef_callback.h"
#include "include/base/cef_weak_ptr.h"
#include "include/cef_waitable_event.h"
#include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
class TestWindowDelegate : public CefWindowDelegate {
public:
// Default window size.

View File

@ -2,6 +2,7 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/base/cef_bind.h"
#include "include/cef_pack_strings.h"
#include "include/views/cef_textfield.h"
#include "include/views/cef_textfield_delegate.h"
@ -9,9 +10,21 @@
#include "tests/unittests/thread_helper.h"
#include "tests/unittests/views/test_window_delegate.h"
#include "base/bind.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/keycodes/keyboard_codes.h"
// See ui/events/keycodes/keyboard_codes.h
#define VKEY_UNKNOWN 0
#if defined(OS_WIN)
#define VKEY_A 'A'
#define VKEY_SPACE VK_SPACE
#define VKEY_RETURN VK_RETURN
#elif defined(OS_POSIX)
#define VKEY_A 0x41
#define VKEY_SPACE 0x20
#define VKEY_RETURN 0x0D
#else
#error "Unsupported platform"
#endif
#define TEXTFIELD_TEST(name) UI_THREAD_TEST(ViewsTextfieldTest, name)
#define TEXTFIELD_TEST_ASYNC(name) \
@ -163,16 +176,16 @@ const int kTextfieldID = 1;
const char kTestInputMessage[] = "Test Message";
void TranslateKey(int c, int* keycode, uint32* modifiers) {
*keycode = ui::VKEY_UNKNOWN;
*keycode = VKEY_UNKNOWN;
*modifiers = 0;
if (c >= 'a' && c <= 'z') {
*keycode = ui::VKEY_A + (c - 'a');
*keycode = VKEY_A + (c - 'a');
} else if (c >= 'A' && c <= 'Z') {
*keycode = ui::VKEY_A + (c - 'A');
*keycode = VKEY_A + (c - 'A');
*modifiers = EVENTFLAG_SHIFT_DOWN;
} else if (c == ' ') {
*keycode = ui::VKEY_SPACE;
*keycode = VKEY_SPACE;
}
}
@ -187,7 +200,7 @@ class TestTextfieldDelegate : public CefTextfieldDelegate {
EXPECT_EQ(textfield->GetID(), kTextfieldID);
if (event.type == KEYEVENT_RAWKEYDOWN &&
event.windows_key_code == ui::VKEY_RETURN) {
event.windows_key_code == VKEY_RETURN) {
// Got the whole string. Finish the test asynchronously.
CefPostTask(TID_UI,
base::Bind(&TestTextfieldDelegate::FinishTest, this, textfield));
@ -262,7 +275,7 @@ void RunTextfieldKeyEvent(CefRefPtr<CefWindow> window) {
}
// Send return to end the text input.
window->SendKeyPress(ui::VKEY_RETURN, 0);
window->SendKeyPress(VKEY_RETURN, 0);
}
void TextfieldKeyEventImpl(CefRefPtr<CefWaitableEvent> event) {

View File

@ -2,6 +2,7 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/base/cef_bind.h"
#include "include/views/cef_box_layout.h"
#include "include/views/cef_panel.h"
#include "include/views/cef_layout.h"
@ -10,7 +11,6 @@
#include "tests/unittests/thread_helper.h"
#include "tests/unittests/views/test_window_delegate.h"
#include "base/bind.h"
#include "testing/gtest/include/gtest/gtest.h"
#define WINDOW_TEST_ASYNC(name) UI_THREAD_TEST_ASYNC(ViewsWindowTest, name)