OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest { | 14 class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest { |
15 public: | 15 public: |
16 // Whitelist the extension ID of the test extension. | 16 // Whitelist the extension ID of the test extension. |
17 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 17 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
18 ExtensionApiTest::SetUpCommandLine(command_line); | 18 ExtensionApiTest::SetUpCommandLine(command_line); |
19 command_line->AppendSwitchASCII( | 19 command_line->AppendSwitchASCII( |
20 switches::kWhitelistedExtensionID, "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 20 switches::kWhitelistedExtensionID, "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
21 } | 21 } |
22 | |
23 void RunNetworkingSubtest(const std::string& subtest) { | |
24 // Make the first character lowercase so we can match naming conventions. | |
25 EXPECT_TRUE(RunExtensionSubtest( | |
26 "networking", "main.html?" + subtest, | |
27 kFlagEnableFileAccess | kFlagLoadAsComponent)) << message_; | |
28 } | |
22 }; | 29 }; |
23 | 30 |
24 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, BasicFunctions) { | 31 // Place each subtest into a separate browser test so that the stub networking |
25 ASSERT_TRUE(RunComponentExtensionTest("networking")) << message_; | 32 // library state is reset for each subtest run. This way they won't affect each |
33 // other. | |
34 | |
35 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, StartConnect) { | |
36 RunNetworkingSubtest("startConnect"); | |
not at google - send to devlin
2013/02/12 23:36:09
The way you have it failures won't be on the line
Greg Spencer (Chromium)
2013/02/12 23:57:42
Good point. Fixed.
| |
37 } | |
38 | |
39 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, StartDisconnect) { | |
40 RunNetworkingSubtest("startDisconnect"); | |
41 } | |
42 | |
43 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | |
44 StartConnectNonexistent) { | |
45 RunNetworkingSubtest("startConnectNonexistent"); | |
46 } | |
47 | |
48 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { | |
49 RunNetworkingSubtest("getVisibleNetworks"); | |
50 } | |
51 | |
52 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | |
53 GetVisibleNetworksWifi) { | |
54 RunNetworkingSubtest("getVisibleNetworksWifi"); | |
55 } | |
56 | |
57 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetProperties) { | |
58 RunNetworkingSubtest("getProperties"); | |
59 } | |
60 | |
61 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | |
62 OnNetworksChangedEvent) { | |
63 RunNetworkingSubtest("onNetworksChangedEvent"); | |
64 } | |
65 | |
66 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | |
67 OnNetworkListChangedEvent) { | |
68 RunNetworkingSubtest("onNetworkListChangedEvent"); | |
26 } | 69 } |
27 | 70 |
28 } // namespace chromeos | 71 } // namespace chromeos |
OLD | NEW |