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

Unified Diff: blimp/test/engine_browsertest.cc

Issue 1929723002: [Blimp] Adds blimp engine browser test framework and LoadUrl test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addresses comments and rebases Created 4 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: blimp/test/engine_browsertest.cc
diff --git a/blimp/test/engine_browsertest.cc b/blimp/test/engine_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..33f0dc3cc5e4ee59bfab60f94ecc4f4ff3978df7
--- /dev/null
+++ b/blimp/test/engine_browsertest.cc
@@ -0,0 +1,70 @@
+// 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/memory/ptr_util.h"
+#include "blimp/test/blimp_browser_test.h"
+#include "blimp/test/test_client.h"
+#include "content/public/test/browser_test.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/geometry/size.h"
+#include "url/gurl.h"
+
+using ::testing::InvokeWithoutArgs;
+
+namespace blimp {
+namespace {
+
+const int kDummyTabId = 0;
+
+// Uses a headless client session to test a full engine.
+class EngineBrowserTest : public BlimpBrowserTest {
+ public:
+ EngineBrowserTest() {}
+
+ protected:
+ void SetUpOnMainThread() override {
+ // Create a headless client on UI thread.
+ client_session_.reset(new TestClientSession);
+
+ // Set feature delegates.
+ client_session_->GetNavigationFeature()->SetDelegate(
+ kDummyTabId, &client_nav_feature_delegate_);
+ client_session_->GetRenderWidgetFeature()->SetDelegate(
+ kDummyTabId, &client_rw_feature_delegate_);
+ client_session_->GetImeFeature()->set_delegate(
+ &client_ime_feature_delegate_);
+
+ BlimpBrowserTest::SetUpOnMainThread();
+ }
+
+ MockNavigationFeatureDelegate client_nav_feature_delegate_;
+ MockRenderWidgetFeatureDelegate client_rw_feature_delegate_;
+ MockImeFeatureDelegate client_ime_feature_delegate_;
+ std::unique_ptr<TestClientSession> client_session_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EngineBrowserTest);
+};
+
+IN_PROC_BROWSER_TEST_F(EngineBrowserTest, LoadUrl) {
+ EXPECT_TRUE(embedded_test_server()->Start());
+ GURL url = embedded_test_server()->GetURL("/hello.html");
+
+ EXPECT_CALL(client_rw_feature_delegate_, OnRenderWidgetCreated(1))
+ .WillOnce(
+ InvokeWithoutArgs(this, &EngineBrowserTest::FinishAsynchronousTest));
+
+ client_session_->Connect(std::string());
Kevin M 2016/05/02 21:32:40 Add a new constructor for test connection paramete
haibinlu 2016/05/03 19:32:43 do you mean command line flags? getting values fr
+ client_session_->GetTabControlFeature()->SetSizeAndScale(gfx::Size(100, 100),
+ 1);
+ client_session_->GetTabControlFeature()->CreateTab(kDummyTabId);
+ client_session_->GetNavigationFeature()->NavigateToUrlText(kDummyTabId,
+ url.spec());
+
+ RunAsynchronousTest();
+}
+
+} // namespace
+} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698