summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/ash_test_base.cc8
-rw-r--r--ash/test/ash_test_base.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 2f48675..cedb895 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -98,6 +98,14 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) {
display_manager_test_api.UpdateDisplay(display_specs);
}
+aura::RootWindow* AshTestBase::CurrentContext() {
+ aura::RootWindow* root_window = Shell::GetActiveRootWindow();
+ if (!root_window)
+ root_window = Shell::GetPrimaryRootWindow();
+ DCHECK(root_window);
+ return root_window;
+}
+
aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) {
return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect());
}
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index 7a1c23b..40ae938 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -56,6 +56,11 @@ class AshTestBase : public testing::Test {
// See ash::test::DisplayManagerTestApi::UpdateDisplay for more details.
void UpdateDisplay(const std::string& display_specs);
+ // Returns a RootWindow. Usually this is the active RootWindow, but that
+ // method can return NULL sometimes, and in those cases, we fall back on the
+ // primary RootWindow.
+ aura::RootWindow* CurrentContext();
+
// Versions of the functions in aura::test:: that go through our shell
// StackingController instead of taking a parent.
aura::Window* CreateTestWindowInShellWithId(int id);