Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/chromeos/first_run/drive_first_run_browsertest.cc

Issue 2393343002: Split ExtensionTestObserver and move to //extensions. (Closed)
Patch Set: fix bug in ActivityLogApiTest.TriggerEvent Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h" 12 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h"
13 #include "chrome/browser/extensions/chrome_extension_test_notification_observer. h"
13 #include "chrome/browser/extensions/crx_installer.h" 14 #include "chrome/browser/extensions/crx_installer.h"
14 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_test_notification_observer.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
17 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
18 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
19 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
20 #include "net/dns/mock_host_resolver.h" 21 #include "net/dns/mock_host_resolver.h"
21 #include "net/http/http_status_code.h" 22 #include "net/http/http_status_code.h"
22 #include "net/test/embedded_test_server/embedded_test_server.h" 23 #include "net/test/embedded_test_server/embedded_test_server.h"
23 #include "net/test/embedded_test_server/http_request.h" 24 #include "net/test/embedded_test_server/http_request.h"
24 #include "net/test/embedded_test_server/http_response.h" 25 #include "net/test/embedded_test_server/http_response.h"
25 26
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 controller_->SetAppInfoForTest(kTestAppId, endpoint_url_); 122 controller_->SetAppInfoForTest(kTestAppId, endpoint_url_);
122 } 123 }
123 124
124 void DriveFirstRunTest::InstallApp() { 125 void DriveFirstRunTest::InstallApp() {
125 ExtensionService* extension_service = extensions::ExtensionSystem::Get( 126 ExtensionService* extension_service = extensions::ExtensionSystem::Get(
126 browser()->profile())->extension_service(); 127 browser()->profile())->extension_service();
127 scoped_refptr<extensions::CrxInstaller> installer = 128 scoped_refptr<extensions::CrxInstaller> installer =
128 extensions::CrxInstaller::CreateSilent(extension_service); 129 extensions::CrxInstaller::CreateSilent(extension_service);
129 130
130 installer->InstallCrx(test_data_dir_.AppendASCII(kTestAppCrxName)); 131 installer->InstallCrx(test_data_dir_.AppendASCII(kTestAppCrxName));
131 ExtensionTestNotificationObserver observer(browser()); 132 ChromeExtensionTestNotificationObserver observer(browser());
132 observer.WaitForExtensionLoad(); 133 observer.WaitForExtensionLoad();
133 134
134 ASSERT_TRUE(extension_service->GetExtensionById(kTestAppId, false)); 135 ASSERT_TRUE(extension_service->GetExtensionById(kTestAppId, false));
135 } 136 }
136 137
137 void DriveFirstRunTest::EnableOfflineMode() { 138 void DriveFirstRunTest::EnableOfflineMode() {
138 controller_->EnableOfflineMode(); 139 controller_->EnableOfflineMode();
139 } 140 }
140 141
141 void DriveFirstRunTest::SetDelays(int initial_delay_secs, int timeout_secs) { 142 void DriveFirstRunTest::SetDelays(int initial_delay_secs, int timeout_secs) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Test that the controller times out instead of hanging forever. 184 // Test that the controller times out instead of hanging forever.
184 InstallApp(); 185 InstallApp();
185 InitTestServer(kBadServerDirectory); 186 InitTestServer(kBadServerDirectory);
186 SetDelays(0, 0); 187 SetDelays(0, 0);
187 EnableOfflineMode(); 188 EnableOfflineMode();
188 EXPECT_FALSE(WaitForFirstRunResult()); 189 EXPECT_FALSE(WaitForFirstRunResult());
189 EXPECT_TRUE(timed_out()); 190 EXPECT_TRUE(timed_out());
190 } 191 }
191 192
192 } // namespace chromeos 193 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698