OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 controller_->SetAppInfoForTest(kTestAppId, kTestEndpointUrl); | 102 controller_->SetAppInfoForTest(kTestAppId, kTestEndpointUrl); |
103 } | 103 } |
104 | 104 |
105 void DriveFirstRunTest::TearDownOnMainThread() { | 105 void DriveFirstRunTest::TearDownOnMainThread() { |
106 content::RunAllPendingInMessageLoop(); | 106 content::RunAllPendingInMessageLoop(); |
107 } | 107 } |
108 | 108 |
109 void DriveFirstRunTest::InitTestServer(const std::string& directory) { | 109 void DriveFirstRunTest::InitTestServer(const std::string& directory) { |
110 embedded_test_server()->ServeFilesFromDirectory( | 110 embedded_test_server()->ServeFilesFromDirectory( |
111 test_data_dir_.AppendASCII(directory)); | 111 test_data_dir_.AppendASCII(directory)); |
112 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 112 ASSERT_TRUE(embedded_test_server()->Start()); |
113 | 113 |
114 // Configure the endpoint to use the test server's port. | 114 // Configure the endpoint to use the test server's port. |
115 const GURL url(kTestEndpointUrl); | 115 const GURL url(kTestEndpointUrl); |
116 GURL::Replacements replacements; | 116 GURL::Replacements replacements; |
117 std::string port(base::IntToString(embedded_test_server()->port())); | 117 std::string port(base::IntToString(embedded_test_server()->port())); |
118 replacements.SetPortStr(port); | 118 replacements.SetPortStr(port); |
119 endpoint_url_ = url.ReplaceComponents(replacements).spec(); | 119 endpoint_url_ = url.ReplaceComponents(replacements).spec(); |
120 controller_->SetAppInfoForTest(kTestAppId, endpoint_url_); | 120 controller_->SetAppInfoForTest(kTestAppId, endpoint_url_); |
121 } | 121 } |
122 | 122 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Test that the controller times out instead of hanging forever. | 182 // Test that the controller times out instead of hanging forever. |
183 InstallApp(); | 183 InstallApp(); |
184 InitTestServer(kBadServerDirectory); | 184 InitTestServer(kBadServerDirectory); |
185 SetDelays(0, 0); | 185 SetDelays(0, 0); |
186 EnableOfflineMode(); | 186 EnableOfflineMode(); |
187 EXPECT_FALSE(WaitForFirstRunResult()); | 187 EXPECT_FALSE(WaitForFirstRunResult()); |
188 EXPECT_TRUE(timed_out()); | 188 EXPECT_TRUE(timed_out()); |
189 } | 189 } |
190 | 190 |
191 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |