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

Side by Side Diff: chrome/browser/chromeos/app_mode/fake_cws.cc

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/app_mode/fake_cws.h" 5 #include "chrome/browser/chromeos/app_mode/fake_cws.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.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 "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "crypto/sha2.h" 16 #include "crypto/sha2.h"
17 #include "net/base/url_util.h" 17 #include "net/base/url_util.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 18 #include "net/test/embedded_test_server/embedded_test_server.h"
19 19
20 using net::test_server::BasicHttpResponse; 20 using net::test_server::BasicHttpResponse;
21 using net::test_server::EmbeddedTestServer;
22 using net::test_server::HttpRequest; 21 using net::test_server::HttpRequest;
23 using net::test_server::HttpResponse; 22 using net::test_server::HttpResponse;
24 23
25 namespace chromeos { 24 namespace chromeos {
26 25
27 namespace { 26 namespace {
28 27
29 const char kWebstoreDomain[] = "cws.com"; 28 const char kWebstoreDomain[] = "cws.com";
30 // Kiosk app crx file download path under web store site. 29 // Kiosk app crx file download path under web store site.
31 const char kCrxDownloadPath[] = "/chromeos/app_mode/webstore/downloads/"; 30 const char kCrxDownloadPath[] = "/chromeos/app_mode/webstore/downloads/";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 68 }
70 69
71 } // namespace 70 } // namespace
72 71
73 FakeCWS::FakeCWS() : update_check_count_(0) { 72 FakeCWS::FakeCWS() : update_check_count_(0) {
74 } 73 }
75 74
76 FakeCWS::~FakeCWS() { 75 FakeCWS::~FakeCWS() {
77 } 76 }
78 77
79 void FakeCWS::Init(EmbeddedTestServer* embedded_test_server) { 78 void FakeCWS::Init(net::EmbeddedTestServer* embedded_test_server) {
80 has_update_template_ = kAppHasUpdateTemplate; 79 has_update_template_ = kAppHasUpdateTemplate;
81 no_update_template_ = kAppNoUpdateTemplate; 80 no_update_template_ = kAppNoUpdateTemplate;
82 update_check_end_point_ = "/update_check.xml"; 81 update_check_end_point_ = "/update_check.xml";
83 82
84 SetupWebStoreURL(embedded_test_server->base_url()); 83 SetupWebStoreURL(embedded_test_server->base_url());
85 OverrideGalleryCommandlineSwitches(); 84 OverrideGalleryCommandlineSwitches();
86 embedded_test_server->RegisterRequestHandler( 85 embedded_test_server->RegisterRequestHandler(
87 base::Bind(&FakeCWS::HandleRequest, base::Unretained(this))); 86 base::Bind(&FakeCWS::HandleRequest, base::Unretained(this)));
88 } 87 }
89 88
90 void FakeCWS::InitAsPrivateStore(EmbeddedTestServer* embedded_test_server, 89 void FakeCWS::InitAsPrivateStore(net::EmbeddedTestServer* embedded_test_server,
91 const std::string& update_check_end_point) { 90 const std::string& update_check_end_point) {
92 has_update_template_ = kPrivateStoreAppHasUpdateTemplate; 91 has_update_template_ = kPrivateStoreAppHasUpdateTemplate;
93 no_update_template_ = kAppNoUpdateTemplate; 92 no_update_template_ = kAppNoUpdateTemplate;
94 update_check_end_point_ = update_check_end_point; 93 update_check_end_point_ = update_check_end_point;
95 94
96 SetupWebStoreURL(embedded_test_server->base_url()); 95 SetupWebStoreURL(embedded_test_server->base_url());
97 embedded_test_server->RegisterRequestHandler( 96 embedded_test_server->RegisterRequestHandler(
98 base::Bind(&FakeCWS::HandleRequest, base::Unretained(this))); 97 base::Bind(&FakeCWS::HandleRequest, base::Unretained(this)));
99 } 98 }
100 99
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 http_response->set_content(update_check_content); 200 http_response->set_content(update_check_content);
202 return http_response.Pass(); 201 return http_response.Pass();
203 } 202 }
204 } 203 }
205 } 204 }
206 205
207 return scoped_ptr<HttpResponse>(); 206 return scoped_ptr<HttpResponse>();
208 } 207 }
209 208
210 } // namespace chromeos 209 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/fake_cws.h ('k') | chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698