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/athena_browser_test.h" | |
6 | |
7 #include "athena/activity/public/activity_manager.h" | |
8 #include "athena/content/public/web_contents_view_delegate_creator.h" | |
9 #include "athena/env/public/athena_env.h" | |
10 #include "athena/main/athena_content_client.h" | |
11 #include "athena/main/athena_renderer_pdf_helper.h" | |
12 #include "athena/main/public/athena_launcher.h" | |
13 #include "athena/test/base/test_util.h" | |
14 #include "base/command_line.h" | |
15 #include "base/logging.h" | |
16 #include "content/public/browser/browser_thread.h" | |
17 #include "content/public/common/content_switches.h" | |
18 #include "extensions/shell/browser/shell_content_browser_client.h" | |
19 | |
20 namespace athena { | |
21 namespace test { | |
22 | |
23 AthenaBrowserTest::AthenaBrowserTest() { | |
24 } | |
25 | |
26 AthenaBrowserTest::~AthenaBrowserTest() { | |
27 } | |
28 | |
29 content::BrowserContext* AthenaBrowserTest::GetBrowserContext() { | |
30 return extensions::ShellContentBrowserClient::Get()->GetBrowserContext(); | |
31 } | |
32 | |
33 void AthenaBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { | |
34 command_line->AppendSwitchASCII(switches::kTestType, "athena"); | |
35 // The NaCl sandbox won't work in our browser tests. | |
36 command_line->AppendSwitch(switches::kNoSandbox); | |
37 content::BrowserTestBase::SetUpCommandLine(command_line); | |
38 } | |
39 | |
40 void AthenaBrowserTest::SetUpOnMainThread() { | |
41 content::BrowserContext* context = GetBrowserContext(); | |
42 athena::StartAthenaEnv(content::BrowserThread::GetBlockingPool() | |
43 ->GetTaskRunnerWithShutdownBehavior( | |
44 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | |
45 athena::CreateVirtualKeyboardWithContext(context); | |
46 athena::StartAthenaSessionWithContext(context); | |
47 | |
48 // Set the memory pressure to low and turning off undeterministic resource | |
49 // observer events. | |
50 test_util::SendTestMemoryPressureEvent(ResourceManager::MEMORY_PRESSURE_LOW); | |
51 } | |
52 | |
53 void AthenaBrowserTest::RunTestOnMainThreadLoop() { | |
54 base::MessageLoopForUI::current()->RunUntilIdle(); | |
55 SetUpOnMainThread(); | |
56 RunTestOnMainThread(); | |
57 TearDownOnMainThread(); | |
58 } | |
59 | |
60 } // namespace test | |
61 } // namespace athena | |
OLD | NEW |