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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 base::FilePath test_data_dir_; | 81 base::FilePath test_data_dir_; |
82 std::string endpoint_url_; | 82 std::string endpoint_url_; |
83 }; | 83 }; |
84 | 84 |
85 DriveFirstRunTest::DriveFirstRunTest() : | 85 DriveFirstRunTest::DriveFirstRunTest() : |
86 timed_out_(false), | 86 timed_out_(false), |
87 waiting_for_result_(false), | 87 waiting_for_result_(false), |
88 success_(false) {} | 88 success_(false) {} |
89 | 89 |
90 void DriveFirstRunTest::SetUpOnMainThread() { | 90 void DriveFirstRunTest::SetUpOnMainThread() { |
91 InProcessBrowserTest::SetUpOnMainThread(); | |
92 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 91 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
93 test_data_dir_ = test_data_dir_.AppendASCII(kTestDirectory); | 92 test_data_dir_ = test_data_dir_.AppendASCII(kTestDirectory); |
94 | 93 |
95 host_resolver()->AddRule("example.com", "127.0.0.1"); | 94 host_resolver()->AddRule("example.com", "127.0.0.1"); |
96 | 95 |
97 // |controller_| will delete itself when it completes. | 96 // |controller_| will delete itself when it completes. |
98 controller_ = new DriveFirstRunController(browser()->profile()); | 97 controller_ = new DriveFirstRunController(browser()->profile()); |
99 controller_->AddObserver(this); | 98 controller_->AddObserver(this); |
100 controller_->SetDelaysForTest(0, 10); | 99 controller_->SetDelaysForTest(0, 10); |
101 controller_->SetAppInfoForTest(kTestAppId, kTestEndpointUrl); | 100 controller_->SetAppInfoForTest(kTestAppId, kTestEndpointUrl); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Test that the controller times out instead of hanging forever. | 173 // Test that the controller times out instead of hanging forever. |
175 InstallApp(); | 174 InstallApp(); |
176 InitTestServer(kBadServerDirectory); | 175 InitTestServer(kBadServerDirectory); |
177 SetDelays(0, 0); | 176 SetDelays(0, 0); |
178 EnableOfflineMode(); | 177 EnableOfflineMode(); |
179 EXPECT_FALSE(WaitForFirstRunResult()); | 178 EXPECT_FALSE(WaitForFirstRunResult()); |
180 EXPECT_TRUE(timed_out()); | 179 EXPECT_TRUE(timed_out()); |
181 } | 180 } |
182 | 181 |
183 } // namespace chromeos | 182 } // namespace chromeos |
OLD | NEW |