Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / chrome / test / base / test_browser_window_aura.cc
blob5b81a820e711cc6ebcfb3fc3b0ecd14e21c1a422
1 // Copyright 2015 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.
5 #include "chrome/test/base/test_browser_window_aura.h"
7 namespace chrome {
9 scoped_ptr<Browser> CreateBrowserWithAuraTestWindowForParams(
10 scoped_ptr<aura::Window> window,
11 Browser::CreateParams* params) {
12 if (window.get() == nullptr) {
13 window.reset(new aura::Window(nullptr));
14 window->set_id(0);
15 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
16 window->Init(ui::LAYER_TEXTURED);
17 window->Show();
20 TestBrowserWindowAura* browser_window =
21 new TestBrowserWindowAura(window.Pass());
22 new TestBrowserWindowOwner(browser_window);
23 return browser_window->CreateBrowser(params);
26 } // namespace chrome
28 TestBrowserWindowAura::TestBrowserWindowAura(
29 scoped_ptr<aura::Window> native_window)
30 : native_window_(native_window.Pass()) {}
32 TestBrowserWindowAura::~TestBrowserWindowAura() {}
34 gfx::NativeWindow TestBrowserWindowAura::GetNativeWindow() const {
35 return native_window_.get();
38 void TestBrowserWindowAura::Show() {
39 native_window_->Show();
42 void TestBrowserWindowAura::Hide() {
43 native_window_->Hide();
46 gfx::Rect TestBrowserWindowAura::GetBounds() const {
47 return native_window_->bounds();
50 scoped_ptr<Browser> TestBrowserWindowAura::CreateBrowser(
51 Browser::CreateParams* params) {
52 params->window = this;
53 browser_ = new Browser(*params);
54 return make_scoped_ptr(browser_);