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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_layout_unittest.cc

Issue 14348011: Add a unit test for BrowserViewLayout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 "chrome/browser/ui/views/frame/browser_view_layout.h"
6
7 #include "chrome/browser/ui/views/frame/browser_view.h"
8 #include "chrome/test/base/browser_with_test_window_test.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 // Tests of the LayoutManger for BrowserView.
12 class BrowserViewLayoutTest : public BrowserWithTestWindowTest {
13 public:
14 BrowserViewLayoutTest() : layout_(NULL) {}
15 virtual ~BrowserViewLayoutTest() {}
16
17 virtual void SetUp() OVERRIDE {
18 // BrowserWithTestWindowTest takes ownership of BrowserView via |window_|.
19 BrowserView* browser_view = new BrowserView;
20 set_window(browser_view);
21
22 // Creates a Browser using |browser_view| as its BrowserWindow.
23 BrowserWithTestWindowTest::SetUp();
24
25 // Memory ownership is tricky here. BrowserView needs ownership of
26 // |browser|, so BrowserWithTestWindowTest cannot continue to own it.
27 Browser* browser = release_browser();
28 browser_view->Init(browser);
29
30 // BrowserView also takes ownership of |layout_|.
31 layout_ = new BrowserViewLayout(browser);
32 browser_view->SetLayoutManager(layout_);
33 }
34
35 BrowserViewLayout* layout() { return layout_; }
36
37 private:
38 BrowserViewLayout* layout_;
39
40 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutTest);
41 };
42
43 // Test basic construction and initialization.
44 TEST_F(BrowserViewLayoutTest, BrowserViewLayout) {
45 EXPECT_TRUE(layout()->browser());
46 EXPECT_TRUE(layout()->GetWebContentsModalDialogHost());
47 EXPECT_EQ(BrowserViewLayout::kInstantUINone, layout()->GetInstantUIState());
48 // TODO(jamescook): Add more as we break dependencies.
49 }
50
51 // Test the core layout functions.
52 TEST_F(BrowserViewLayoutTest, Layout) {
53 // We don't have a bookmark bar yet, so no contents offset is required.
54 EXPECT_EQ(0, layout()->GetContentsOffsetForBookmarkBar());
55 EXPECT_EQ(0, layout()->GetTopMarginForActiveContent());
56 EXPECT_EQ(0, layout()->GetTopMarginForOverlayContent());
57 // TODO(jamescook): Add more as we break dependencies.
58 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698