OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 "athena/test/base/test_util.h" | |
6 | |
7 #include "athena/activity/public/activity.h" | |
8 #include "athena/activity/public/activity_factory.h" | |
9 #include "athena/resource_manager/public/resource_manager.h" | |
10 #include "content/public/browser/notification_service.h" | |
11 #include "content/public/test/test_utils.h" | |
12 #include "extensions/browser/notification_types.h" | |
13 | |
14 namespace athena { | |
15 namespace test_util { | |
16 | |
17 void SendTestMemoryPressureEvent(ResourceManager::MemoryPressure pressure) { | |
18 CHECK(ResourceManager::Get()); | |
19 ResourceManager::Get()->SetMemoryPressureAndStopMonitoring(pressure); | |
20 WaitUntilIdle(); | |
21 } | |
22 | |
23 Activity* CreateTestWebActivity(content::BrowserContext* context, | |
24 const base::string16& title, | |
25 const GURL& url) { | |
26 content::WindowedNotificationObserver observer( | |
27 content::NOTIFICATION_LOAD_STOP, | |
28 content::NotificationService::AllSources()); | |
29 Activity* activity = | |
30 ActivityFactory::Get()->CreateWebActivity(context, title, url); | |
31 Activity::Show(activity); | |
32 observer.Wait(); | |
33 return activity; | |
34 } | |
35 | |
36 void WaitUntilIdle() { | |
37 base::MessageLoopForUI::current()->RunUntilIdle(); | |
38 } | |
39 | |
40 } // namespace test_util | |
41 } // namespace athena | |
OLD | NEW |