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

Side by Side Diff: chrome/browser/search/iframe_source_unittest.cc

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/search/iframe_source.h ('k') | chrome/browser/search/instant_service.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 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 "chrome/browser/search/iframe_source.h" 5 #include "chrome/browser/search/iframe_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 20 matching lines...) Expand all
31 const int kInvalidRendererPID = 42; 31 const int kInvalidRendererPID = 42;
32 32
33 class TestIframeSource : public IframeSource { 33 class TestIframeSource : public IframeSource {
34 public: 34 public:
35 using IframeSource::GetMimeType; 35 using IframeSource::GetMimeType;
36 using IframeSource::ShouldServiceRequest; 36 using IframeSource::ShouldServiceRequest;
37 using IframeSource::SendResource; 37 using IframeSource::SendResource;
38 using IframeSource::SendJSWithOrigin; 38 using IframeSource::SendJSWithOrigin;
39 39
40 protected: 40 protected:
41 virtual std::string GetSource() const override { 41 std::string GetSource() const override { return "test"; }
42 return "test";
43 }
44 42
45 virtual bool ServesPath(const std::string& path) const override { 43 bool ServesPath(const std::string& path) const override {
46 return path == "/valid.html" || path == "/valid.js"; 44 return path == "/valid.html" || path == "/valid.js";
47 } 45 }
48 46
49 virtual void StartDataRequest( 47 void StartDataRequest(
50 const std::string& path, 48 const std::string& path,
51 int render_process_id, 49 int render_process_id,
52 int render_frame_id, 50 int render_frame_id,
53 const content::URLDataSource::GotDataCallback& callback) override { 51 const content::URLDataSource::GotDataCallback& callback) override {}
54 }
55 52
56 // RenderFrameHost is hard to mock in concert with everything else, so stub 53 // RenderFrameHost is hard to mock in concert with everything else, so stub
57 // this method out for testing. 54 // this method out for testing.
58 virtual bool GetOrigin( 55 bool GetOrigin(int process_id,
59 int process_id, 56 int render_frame_id,
60 int render_frame_id, 57 std::string* origin) const override {
61 std::string* origin) const override {
62 if (process_id == kInstantRendererPID) { 58 if (process_id == kInstantRendererPID) {
63 *origin = kInstantOrigin; 59 *origin = kInstantOrigin;
64 return true; 60 return true;
65 } 61 }
66 if (process_id == kNonInstantRendererPID) { 62 if (process_id == kNonInstantRendererPID) {
67 *origin = kNonInstantOrigin; 63 *origin = kNonInstantOrigin;
68 return true; 64 return true;
69 } 65 }
70 return false; 66 return false;
71 } 67 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 192 }
197 193
198 TEST_F(IframeSourceTest, SendJSWithOrigin) { 194 TEST_F(IframeSourceTest, SendJSWithOrigin) {
199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); 195 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0);
200 EXPECT_FALSE(response_string().empty()); 196 EXPECT_FALSE(response_string().empty());
201 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); 197 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0);
202 EXPECT_FALSE(response_string().empty()); 198 EXPECT_FALSE(response_string().empty());
203 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); 199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0);
204 EXPECT_TRUE(response_string().empty()); 200 EXPECT_TRUE(response_string().empty());
205 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/search/iframe_source.h ('k') | chrome/browser/search/instant_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698