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

Side by Side Diff: chrome/test/ppapi/ppapi_filechooser_browsertest.cc

Issue 1431653003: Migrating tests to use EmbeddedTestServer (misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. 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
« no previous file with comments | « chrome/test/perf/mach_ports_performancetest.cc ('k') | chrome/test/ppapi/ppapi_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 Mode mode_; 124 Mode mode_;
125 }; 125 };
126 126
127 class FakeDatabaseManager 127 class FakeDatabaseManager
128 : public safe_browsing::TestSafeBrowsingDatabaseManager { 128 : public safe_browsing::TestSafeBrowsingDatabaseManager {
129 public: 129 public:
130 bool IsSupported() const override { return true; } 130 bool IsSupported() const override { return true; }
131 bool MatchDownloadWhitelistUrl(const GURL& url) override { 131 bool MatchDownloadWhitelistUrl(const GURL& url) override {
132 // This matches the behavior in RunTestViaHTTP(). 132 // This matches the behavior in RunTestViaHTTP().
133 return url.SchemeIsHTTPOrHTTPS() && url.has_path() && 133 return url.SchemeIsHTTPOrHTTPS() && url.has_path() &&
134 url.path().find("/files/test_case.html") == 0; 134 url.path().find("/test_case.html") == 0;
135 } 135 }
136 136
137 protected: 137 protected:
138 ~FakeDatabaseManager() override {} 138 ~FakeDatabaseManager() override {}
139 }; 139 };
140 140
141 class TestSafeBrowsingService : public SafeBrowsingService { 141 class TestSafeBrowsingService : public SafeBrowsingService {
142 public: 142 public:
143 safe_browsing::SafeBrowsingDatabaseManager* CreateDatabaseManager() override { 143 safe_browsing::SafeBrowsingDatabaseManager* CreateDatabaseManager() override {
144 return new FakeDatabaseManager(); 144 return new FakeDatabaseManager();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 RunTestViaHTTP("FileChooser_SaveAsDangerousExecutableAllowed"); 331 RunTestViaHTTP("FileChooser_SaveAsDangerousExecutableAllowed");
332 base::FilePath actual_filename = temp_dir.path().AppendASCII("dangerous.exe"); 332 base::FilePath actual_filename = temp_dir.path().AppendASCII("dangerous.exe");
333 333
334 ASSERT_TRUE(base::PathExists(actual_filename)); 334 ASSERT_TRUE(base::PathExists(actual_filename));
335 std::string file_contents; 335 std::string file_contents;
336 ASSERT_TRUE(base::ReadFileToString(actual_filename, &file_contents, 100)); 336 ASSERT_TRUE(base::ReadFileToString(actual_filename, &file_contents, 100));
337 EXPECT_EQ("Hello from PPAPI", file_contents); 337 EXPECT_EQ("Hello from PPAPI", file_contents);
338 } 338 }
339 339
340 #endif // FULL_SAFE_BROWSING 340 #endif // FULL_SAFE_BROWSING
OLDNEW
« no previous file with comments | « chrome/test/perf/mach_ports_performancetest.cc ('k') | chrome/test/ppapi/ppapi_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698