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/stringprintf.h" | 7 #include "base/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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 MATCHER(IsExpectedUserSettings, "") { | 78 MATCHER(IsExpectedUserSettings, "") { |
79 const UserSettings& settings = arg; | 79 const UserSettings& settings = arg; |
80 return settings.connect_new_printers && | 80 return settings.connect_new_printers && |
81 settings.printers.size() == 2 && | 81 settings.printers.size() == 2 && |
82 settings.printers[0]->name == "printer1" && | 82 settings.printers[0]->name == "printer1" && |
83 !settings.printers[0]->connect && | 83 !settings.printers[0]->connect && |
84 settings.printers[1]->name == "printer2" && | 84 settings.printers[1]->name == "printer2" && |
85 settings.printers[1]->connect; | 85 settings.printers[1]->connect; |
86 } | 86 } |
87 | 87 |
88 IN_PROC_BROWSER_TEST_F(ExtensionCloudPrintPrivateApiTest, CloudPrintHosted) { | 88 // http://crbug.com/177163 |
| 89 #if defined(OS_WIN) && !defined(NDEBUG) |
| 90 #define MAYBE_CloudPrintHosted DISABLED_CloudPrintHosted |
| 91 #else |
| 92 #define MAYBE_CloudPrintHosted CloudPrintHosted |
| 93 #endif |
| 94 IN_PROC_BROWSER_TEST_F(ExtensionCloudPrintPrivateApiTest, |
| 95 MAYBE_CloudPrintHosted) { |
89 CloudPrintTestsDelegateMock cloud_print_mock; | 96 CloudPrintTestsDelegateMock cloud_print_mock; |
90 | 97 |
91 EXPECT_CALL(cloud_print_mock, | 98 EXPECT_CALL(cloud_print_mock, |
92 SetupConnector("foo@gmail.com", | 99 SetupConnector("foo@gmail.com", |
93 "foorobot@googleusercontent.com", | 100 "foorobot@googleusercontent.com", |
94 "1/23546efa54", | 101 "1/23546efa54", |
95 IsExpectedUserSettings())); | 102 IsExpectedUserSettings())); |
96 EXPECT_CALL(cloud_print_mock, GetHostName()) | 103 EXPECT_CALL(cloud_print_mock, GetHostName()) |
97 .WillRepeatedly(Return("TestHostName")); | 104 .WillRepeatedly(Return("TestHostName")); |
98 | 105 |
99 std::vector<std::string> printers; | 106 std::vector<std::string> printers; |
100 printers.push_back("printer1"); | 107 printers.push_back("printer1"); |
101 printers.push_back("printer2"); | 108 printers.push_back("printer2"); |
102 EXPECT_CALL(cloud_print_mock, GetPrinters()) | 109 EXPECT_CALL(cloud_print_mock, GetPrinters()) |
103 .WillRepeatedly(Return(printers)); | 110 .WillRepeatedly(Return(printers)); |
104 | 111 |
105 EXPECT_CALL(cloud_print_mock, GetClientId()) | 112 EXPECT_CALL(cloud_print_mock, GetClientId()) |
106 .WillRepeatedly(Return("TestAPIClient")); | 113 .WillRepeatedly(Return("TestAPIClient")); |
107 | 114 |
108 // Run this as a hosted app. Since we have overridden the cloud print service | 115 // Run this as a hosted app. Since we have overridden the cloud print service |
109 // URL in the command line, this URL should match the web extent for our | 116 // URL in the command line, this URL should match the web extent for our |
110 // cloud print component app and it should work. | 117 // cloud print component app and it should work. |
111 GURL page_url = GetTestServerURL( | 118 GURL page_url = GetTestServerURL( |
112 "enable_chrome_connector/cloud_print_success_tests.html"); | 119 "enable_chrome_connector/cloud_print_success_tests.html"); |
113 ASSERT_TRUE(RunPageTest(page_url.spec())); | 120 ASSERT_TRUE(RunPageTest(page_url.spec())); |
114 } | 121 } |
115 | 122 |
116 #endif // !defined(OS_CHROMEOS) | 123 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |