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

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

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 virtual std::string GetSource() const override {
42 return "test"; 42 return "test";
43 } 43 }
44 44
45 virtual bool ServesPath(const std::string& path) const OVERRIDE { 45 virtual bool ServesPath(const std::string& path) const override {
46 return path == "/valid.html" || path == "/valid.js"; 46 return path == "/valid.html" || path == "/valid.js";
47 } 47 }
48 48
49 virtual void StartDataRequest( 49 virtual void StartDataRequest(
50 const std::string& path, 50 const std::string& path,
51 int render_process_id, 51 int render_process_id,
52 int render_frame_id, 52 int render_frame_id,
53 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { 53 const content::URLDataSource::GotDataCallback& callback) override {
54 } 54 }
55 55
56 // RenderFrameHost is hard to mock in concert with everything else, so stub 56 // RenderFrameHost is hard to mock in concert with everything else, so stub
57 // this method out for testing. 57 // this method out for testing.
58 virtual bool GetOrigin( 58 virtual bool GetOrigin(
59 int process_id, 59 int process_id,
60 int render_frame_id, 60 int render_frame_id,
61 std::string* origin) const OVERRIDE { 61 std::string* origin) const override {
62 if (process_id == kInstantRendererPID) { 62 if (process_id == kInstantRendererPID) {
63 *origin = kInstantOrigin; 63 *origin = kInstantOrigin;
64 return true; 64 return true;
65 } 65 }
66 if (process_id == kNonInstantRendererPID) { 66 if (process_id == kNonInstantRendererPID) {
67 *origin = kNonInstantOrigin; 67 *origin = kNonInstantOrigin;
68 return true; 68 return true;
69 } 69 }
70 return false; 70 return false;
71 } 71 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 void SendJSWithOrigin( 124 void SendJSWithOrigin(
125 int resource_id, 125 int resource_id,
126 int render_process_id, 126 int render_process_id,
127 int render_frame_id) { 127 int render_frame_id) {
128 source()->SendJSWithOrigin(resource_id, render_process_id, render_frame_id, 128 source()->SendJSWithOrigin(resource_id, render_process_id, render_frame_id,
129 callback_); 129 callback_);
130 } 130 }
131 131
132 private: 132 private:
133 virtual void SetUp() OVERRIDE { 133 virtual void SetUp() override {
134 source_.reset(new TestIframeSource()); 134 source_.reset(new TestIframeSource());
135 callback_ = base::Bind(&IframeSourceTest::SaveResponse, 135 callback_ = base::Bind(&IframeSourceTest::SaveResponse,
136 base::Unretained(this)); 136 base::Unretained(this));
137 instant_io_context_ = new InstantIOContext; 137 instant_io_context_ = new InstantIOContext;
138 InstantIOContext::SetUserDataOnIO(&resource_context_, instant_io_context_); 138 InstantIOContext::SetUserDataOnIO(&resource_context_, instant_io_context_);
139 InstantIOContext::AddInstantProcessOnIO(instant_io_context_, 139 InstantIOContext::AddInstantProcessOnIO(instant_io_context_,
140 kInstantRendererPID); 140 kInstantRendererPID);
141 response_ = NULL; 141 response_ = NULL;
142 } 142 }
143 143
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 TEST_F(IframeSourceTest, SendJSWithOrigin) { 198 TEST_F(IframeSourceTest, SendJSWithOrigin) {
199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0); 199 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInstantRendererPID, 0);
200 EXPECT_FALSE(response_string().empty()); 200 EXPECT_FALSE(response_string().empty());
201 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0); 201 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kNonInstantRendererPID, 0);
202 EXPECT_FALSE(response_string().empty()); 202 EXPECT_FALSE(response_string().empty());
203 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0); 203 SendJSWithOrigin(IDR_MOST_VISITED_TITLE_JS, kInvalidRendererPID, 0);
204 EXPECT_TRUE(response_string().empty()); 204 EXPECT_TRUE(response_string().empty());
205 } 205 }
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