ash_test_base.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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#ifndef ASH_TEST_ASH_TEST_BASE_H_ 6#define ASH_TEST_ASH_TEST_BASE_H_ 7 8#include <string> 9 10#include "ash/shell.h" 11#include "base/compiler_specific.h" 12#include "base/message_loop.h" 13#include "testing/gtest/include/gtest/gtest.h" 14#include "ui/views/test/test_views_delegate.h" 15 16namespace ash { 17namespace internal { 18class MultiDisplayManager; 19} // internal 20 21namespace test { 22 23class AshTestViewsDelegate : public views::TestViewsDelegate { 24 public: 25 // Overriden from TestViewsDelegate. 26 virtual content::WebContents* CreateWebContents( 27 content::BrowserContext* browser_context, 28 content::SiteInstance* site_instance) OVERRIDE; 29}; 30 31class AshTestBase : public testing::Test { 32 public: 33 AshTestBase(); 34 virtual ~AshTestBase(); 35 36 MessageLoopForUI* message_loop() { return &message_loop_; } 37 38 // testing::Test: 39 virtual void SetUp() OVERRIDE; 40 virtual void TearDown() OVERRIDE; 41 42 // Change the primary display's configuration to use |bounds| 43 // and |scale|. 44 void ChangeDisplayConfig(float scale, const gfx::Rect& bounds); 45 46 // Update the display configuration as given in |display_specs|. 47 // See ash::test::MultiDisplayManagerTestApi::UpdateDisplay for more details. 48 void UpdateDisplay(const std::string& display_specs); 49 50 protected: 51 void RunAllPendingInMessageLoop(); 52 53 private: 54 MessageLoopForUI message_loop_; 55 56 DISALLOW_COPY_AND_ASSIGN(AshTestBase); 57}; 58 59} // namespace test 60} // namespace ash 61 62#endif // ASH_TEST_ASH_TEST_BASE_H_ 63