Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: apps/shell/test/app_shell_test.cc

Issue 224723022: Add the first app_shell_browsertest test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/test/app_shell_test.h" 5 #include "apps/shell/test/app_shell_test.h"
6 6
7 #include "apps/shell/browser/shell_content_browser_client.h" 7 #include "apps/shell/browser/shell_content_browser_client.h"
8 #include "apps/shell/browser/shell_desktop_controller.h"
8 #include "apps/shell/browser/shell_extension_system.h" 9 #include "apps/shell/browser/shell_extension_system.h"
10 #include "base/command_line.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "content/public/common/content_switches.h"
11 #include "extensions/browser/extension_system.h" 14 #include "extensions/browser/extension_system.h"
12 15
13 namespace apps { 16 namespace apps {
14 17
15 AppShellTest::AppShellTest() 18 AppShellTest::AppShellTest()
16 : browser_context_(NULL), extension_system_(NULL) {} 19 : browser_context_(NULL), extension_system_(NULL) {}
17 20
18 AppShellTest::~AppShellTest() {} 21 AppShellTest::~AppShellTest() {}
19 22
23 void AppShellTest::SetUp() {
24 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
25 command_line->AppendSwitchASCII(switches::kTestType, "appshell");
James Cook 2014/04/08 16:03:49 Just curious, why do we need a testtype switch?
Yoyo Zhou 2014/04/08 21:55:21 The chrome.test API checks that it's running with
26 content::BrowserTestBase::SetUp();
27 }
28
29 void AppShellTest::TearDown() { content::BrowserTestBase::TearDown(); }
James Cook 2014/04/08 16:03:49 Do you anticipate this function doing more than ca
Yoyo Zhou 2014/04/08 21:55:21 Done.
30
20 void AppShellTest::SetUpOnMainThread() { 31 void AppShellTest::SetUpOnMainThread() {
21 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext(); 32 browser_context_ = ShellContentBrowserClient::Get()->GetBrowserContext();
22 33
23 extension_system_ = static_cast<extensions::ShellExtensionSystem*>( 34 extension_system_ = static_cast<extensions::ShellExtensionSystem*>(
24 extensions::ExtensionSystem::Get(browser_context_)); 35 extensions::ExtensionSystem::Get(browser_context_));
25 } 36 }
26 37
27 void AppShellTest::RunTestOnMainThreadLoop() { 38 void AppShellTest::RunTestOnMainThreadLoop() {
28 // Pump startup related events.
29 base::MessageLoopForUI::current()->RunUntilIdle(); 39 base::MessageLoopForUI::current()->RunUntilIdle();
30 40
31 SetUpOnMainThread(); 41 SetUpOnMainThread();
32 42
33 RunTestOnMainThread(); 43 RunTestOnMainThread();
34 44
35 TearDownOnMainThread(); 45 TearDownOnMainThread();
46
47 // Clean up the app window.
48 ShellDesktopController::instance()->CloseAppWindow();
36 } 49 }
37 50
38 bool AppShellTest::LoadAndLaunchApp(const base::FilePath& app_dir) { 51 bool AppShellTest::LoadAndLaunchApp(const base::FilePath& app_dir) {
39 return extension_system_->LoadAndLaunchApp(app_dir); 52 return extension_system_->LoadAndLaunchApp(app_dir);
40 } 53 }
41 54
42 } // namespace apps 55 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698