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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/memory/ptr_util.h"
6 #include "blimp/test/blimp_browser_test.h"
7 #include "blimp/test/test_client.h"
8 #include "content/public/test/browser_test.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "url/gurl.h"
13
14 using ::testing::InvokeWithoutArgs;
15
16 namespace blimp {
17 namespace {
18
19 const int kDummyTabId = 0;
20
21 // Uses a headless client session to test a full engine.
22 class EngineBrowserTest : public BlimpBrowserTest {
23 public:
24 EngineBrowserTest() {}
25
26 protected:
27 void SetUpOnMainThread() override {
28 // Create a headless client on UI thread.
29 client_session_.reset(new TestClientSession);
30
31 // Set feature delegates.
32 client_session_->GetNavigationFeature()->SetDelegate(
33 kDummyTabId, &client_nav_feature_delegate_);
34 client_session_->GetRenderWidgetFeature()->SetDelegate(
35 kDummyTabId, &client_rw_feature_delegate_);
36 client_session_->GetImeFeature()->set_delegate(
37 &client_ime_feature_delegate_);
38
39 BlimpBrowserTest::SetUpOnMainThread();
40 }
41
42 MockNavigationFeatureDelegate client_nav_feature_delegate_;
43 MockRenderWidgetFeatureDelegate client_rw_feature_delegate_;
44 MockImeFeatureDelegate client_ime_feature_delegate_;
45 std::unique_ptr<TestClientSession> client_session_;
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(EngineBrowserTest);
49 };
50
51 IN_PROC_BROWSER_TEST_F(EngineBrowserTest, LoadUrl) {
52 EXPECT_TRUE(embedded_test_server()->Start());
53 GURL url = embedded_test_server()->GetURL("/hello.html");
54
55 EXPECT_CALL(client_rw_feature_delegate_, OnRenderWidgetCreated(1))
56 .WillOnce(
57 InvokeWithoutArgs(this, &EngineBrowserTest::FinishAsynchronousTest));
58
59 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
60 client_session_->GetTabControlFeature()->SetSizeAndScale(gfx::Size(100, 100),
61 1);
62 client_session_->GetTabControlFeature()->CreateTab(kDummyTabId);
63 client_session_->GetNavigationFeature()->NavigateToUrlText(kDummyTabId,
64 url.spec());
65
66 RunAsynchronousTest();
67 }
68
69 } // namespace
70 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698