summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-07 21:40:35 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-07 21:40:35 +0000
commita2e6af1853d23b82a87b4ae6554424cc6e5393fb (patch)
treece0517e27e276e014f7cbec6ecc662c6f064a83d /ash/test
parent7a97aa864a3f602b4c032d3088df79528d69454f (diff)
downloadchromium_src-a2e6af1853d23b82a87b4ae6554424cc6e5393fb.zip
chromium_src-a2e6af1853d23b82a87b4ae6554424cc6e5393fb.tar.gz
chromium_src-a2e6af1853d23b82a87b4ae6554424cc6e5393fb.tar.bz2
Continue threading context through unit tests.
- views_unittest now passes with the assert that checks that we have context. - ash_unittest...is making progress towards that and this patch is already big. BUG=161882 Review URL: https://codereview.chromium.org/11795004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175389 0039d316-1c4b-4281-b951-d872f2087c98
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);