OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 "apps/app_window_registry.h" | |
xiyuan
2014/03/20 04:59:54
seems not used.
rkc
2014/03/20 21:45:01
Done.
| |
6 #include "base/command_line.h" | |
7 #include "base/files/file_path.h" | |
8 #include "base/path_service.h" | |
9 #include "chrome/browser/apps/app_browsertest_util.h" | |
xiyuan
2014/03/20 04:59:54
is this needed?
rkc
2014/03/20 21:45:01
Done.
| |
10 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | |
11 #include "chrome/browser/extensions/extension_test_message_listener.h" | |
12 #include "chrome/browser/profiles/profile_manager.h" | |
xiyuan
2014/03/20 04:59:54
no longer needed.
rkc
2014/03/20 21:45:01
Done.
| |
13 #include "chrome/common/chrome_paths.h" | |
14 #include "chromeos/chromeos_switches.h" | |
15 #include "content/public/test/test_utils.h" | |
bartfab (slow)
2014/03/20 13:22:29
Nit: Is this used?
rkc
2014/03/20 21:45:01
Done.
| |
16 #include "extensions/common/extension.h" | |
xiyuan
2014/03/20 04:59:54
seems not used.
rkc
2014/03/20 21:45:01
Done.
| |
17 | |
18 | |
xiyuan
2014/03/20 01:14:03
nit: nuke one empty line
rkc
2014/03/20 21:45:01
Done.
| |
19 namespace chromeos { | |
20 | |
21 char kDemoAppId[] = "klimoghijjogocdbaikffefjfcfheiel"; | |
xiyuan
2014/03/20 04:59:54
not used.
rkc
2014/03/20 21:45:01
Done.
| |
22 | |
23 class DemoAppLauncherTest : public InProcessBrowserTest { | |
xiyuan
2014/03/20 04:59:54
Let's still derive from ExtensionBrowserTest to be
bartfab (slow)
2014/03/20 13:22:29
Nit: #include "chrome/test/base/in_process_browser
rkc
2014/03/20 21:45:01
Done.
rkc
2014/03/20 21:45:01
Deriving from ExtensionBrowserTest now, so not rel
| |
24 public: | |
25 DemoAppLauncherTest() { | |
26 set_exit_when_last_browser_closes(false); | |
27 } | |
28 virtual ~DemoAppLauncherTest() {} | |
bartfab (slow)
2014/03/20 13:22:29
Nit: add blank line above.
rkc
2014/03/20 21:45:01
Done.
| |
29 | |
30 virtual void SetUpCommandLine(CommandLine* cmd_line) OVERRIDE { | |
bartfab (slow)
2014/03/20 13:22:29
Nit 1: Avoid abbreviations: s/cmd_line/command_lin
rkc
2014/03/20 21:45:01
Done.
| |
31 cmd_line->AppendSwitch(chromeos::switches::kLoginManager); | |
bartfab (slow)
2014/03/20 13:22:29
Nit: Here and below: No need for the chromeos:: pr
rkc
2014/03/20 21:45:01
Done.
| |
32 cmd_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); | |
33 cmd_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | |
34 | |
35 cmd_line->AppendSwitchASCII(chromeos::switches::kDerelictIdleTimeout, "0"); | |
36 cmd_line->AppendSwitchASCII(chromeos::switches::kOobeTimerInterval, "0"); | |
37 cmd_line->AppendSwitchASCII(chromeos::switches::kDerelictDetectionTimeout, | |
38 "0"); | |
39 } | |
40 | |
41 virtual void SetUp() OVERRIDE { | |
42 chromeos::DemoAppLauncher::SetDemoAppPathForTesting(GetTestDemoAppPath()); | |
43 InProcessBrowserTest::SetUp(); | |
44 } | |
45 | |
46 base::FilePath GetTestDemoAppPath() { | |
bartfab (slow)
2014/03/20 13:22:29
Why is GetTestDemoAppPath() a separate method? The
bartfab (slow)
2014/03/20 13:22:29
Nit: This should be a const method.
rkc
2014/03/20 21:45:01
Done.
rkc
2014/03/20 21:45:01
Getting the path to the test demo app is an indivi
| |
47 base::FilePath test_data_dir; | |
48 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
bartfab (slow)
2014/03/20 13:22:29
Nit: PathService::Get() is normally wrapped in an
rkc
2014/03/20 21:45:01
ASSERT and FAIL have issues with returning a FileP
xiyuan
2014/03/20 21:59:44
We can also CHECK. Some tests do that when the enc
bartfab (slow)
2014/03/21 10:37:32
I think CHECKs in tests are a bad idea. They crash
| |
49 return test_data_dir.Append(FILE_PATH_LITERAL("chromeos/demo_app")); | |
50 } | |
51 | |
52 void VerifyDemoAppLaunch() { | |
53 ExtensionTestMessageListener | |
bartfab (slow)
2014/03/20 13:22:29
Nit: You can do this with a temporary:
EXPECT_TRU
rkc
2014/03/20 21:45:01
Done.
| |
54 launch_data_check_listener("launchedDemoApp", false); | |
55 EXPECT_TRUE(launch_data_check_listener.WaitUntilSatisfied()); | |
bartfab (slow)
2014/03/20 13:22:29
1: Overall, this is racy. What if the app manages
rkc
2014/03/20 21:45:01
1.) We don't actually run the message loop until w
bartfab (slow)
2014/03/21 10:37:32
1.) InProcessBrowserTest spins the loop before we
xiyuan
2014/03/21 16:38:16
How about we make it a member of DemoAppLauncherTe
rkc
2014/03/21 23:31:18
Xiyuan and I discussed this offline. This test is
| |
56 } | |
xiyuan
2014/03/20 01:14:03
nit: wrong indent
rkc
2014/03/20 21:45:01
Done.
| |
57 | |
58 private: | |
59 DISALLOW_COPY_AND_ASSIGN(DemoAppLauncherTest); | |
bartfab (slow)
2014/03/20 13:22:29
Nit: #include "base/basictypes.h"
rkc
2014/03/20 21:45:01
Done.
| |
60 }; | |
61 | |
62 IN_PROC_BROWSER_TEST_F(DemoAppLauncherTest, Basic) { | |
63 VerifyDemoAppLaunch(); | |
bartfab (slow)
2014/03/20 13:22:29
Nit: Move the body of your test into here. No need
rkc
2014/03/20 21:45:01
I prefer this in a separate method. This will pote
bartfab (slow)
2014/03/21 10:37:32
The problem is that the EXPECT* and ASSERT* macros
rkc
2014/03/21 23:31:18
Changed this to have the EXPECT_ in the main test
| |
64 } | |
65 | |
66 } // namespace chromeos | |
OLD | NEW |