OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_
api.h" | 5 #include "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_
api.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/common/extensions/api/cloud_print_private.h" | 11 #include "chrome/common/extensions/api/cloud_print_private.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "components/cloud_devices/common/cloud_devices_switches.h" | 13 #include "components/cloud_devices/common/cloud_devices_switches.h" |
14 #include "net/dns/mock_host_resolver.h" | 14 #include "net/dns/mock_host_resolver.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using ::testing::Eq; | 18 using ::testing::Eq; |
19 using ::testing::Property; | 19 using ::testing::Property; |
20 using ::testing::Return; | 20 using ::testing::Return; |
21 using ::testing::_; | 21 using ::testing::_; |
22 | 22 |
23 // A base class for tests below. | 23 // A base class for tests below. |
24 class ExtensionCloudPrintPrivateApiTest : public ExtensionApiTest { | 24 class ExtensionCloudPrintPrivateApiTest : public ExtensionApiTest { |
25 public: | 25 public: |
26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 26 virtual void SetUpCommandLine(CommandLine* command_line) override { |
27 ExtensionApiTest::SetUpCommandLine(command_line); | 27 ExtensionApiTest::SetUpCommandLine(command_line); |
28 command_line->AppendSwitchASCII( | 28 command_line->AppendSwitchASCII( |
29 switches::kCloudPrintURL, | 29 switches::kCloudPrintURL, |
30 "http://www.cloudprintapp.com/files/extensions/api_test/" | 30 "http://www.cloudprintapp.com/files/extensions/api_test/" |
31 "cloud_print_private"); | 31 "cloud_print_private"); |
32 } | 32 } |
33 | 33 |
34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 34 virtual void SetUpInProcessBrowserTestFixture() override { |
35 // Start up the test server and get us ready for calling the install | 35 // Start up the test server and get us ready for calling the install |
36 // API functions. | 36 // API functions. |
37 host_resolver()->AddRule("www.cloudprintapp.com", "127.0.0.1"); | 37 host_resolver()->AddRule("www.cloudprintapp.com", "127.0.0.1"); |
38 ASSERT_TRUE(test_server()->Start()); | 38 ASSERT_TRUE(test_server()->Start()); |
39 } | 39 } |
40 | 40 |
41 protected: | 41 protected: |
42 // Returns a test server URL, but with host 'www.cloudprintapp.com' so it | 42 // Returns a test server URL, but with host 'www.cloudprintapp.com' so it |
43 // matches the cloud print app's extent that we set up via command line | 43 // matches the cloud print app's extent that we set up via command line |
44 // flags. | 44 // flags. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // Run this as a hosted app. Since we have overridden the cloud print service | 116 // Run this as a hosted app. Since we have overridden the cloud print service |
117 // URL in the command line, this URL should match the web extent for our | 117 // URL in the command line, this URL should match the web extent for our |
118 // cloud print component app and it should work. | 118 // cloud print component app and it should work. |
119 GURL page_url = GetTestServerURL( | 119 GURL page_url = GetTestServerURL( |
120 "enable_chrome_connector/cloud_print_success_tests.html"); | 120 "enable_chrome_connector/cloud_print_success_tests.html"); |
121 ASSERT_TRUE(RunPageTest(page_url.spec())); | 121 ASSERT_TRUE(RunPageTest(page_url.spec())); |
122 } | 122 } |
123 | 123 |
124 #endif // !defined(OS_CHROMEOS) | 124 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |