| OLD | NEW | 
|---|
| 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.h" | 10 #include "base/message_loop.h" | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133   } | 133   } | 
| 134 | 134 | 
| 135   virtual void TearDown() { | 135   virtual void TearDown() { | 
| 136     source_.reset(); | 136     source_.reset(); | 
| 137   } | 137   } | 
| 138 | 138 | 
| 139   void SaveResponse(base::RefCountedMemory* data) { | 139   void SaveResponse(base::RefCountedMemory* data) { | 
| 140     response_ = data; | 140     response_ = data; | 
| 141   } | 141   } | 
| 142 | 142 | 
| 143   MessageLoop message_loop_; | 143   base::MessageLoop message_loop_; | 
| 144   content::TestBrowserThread ui_thread_; | 144   content::TestBrowserThread ui_thread_; | 
| 145   content::TestBrowserThread io_thread_; | 145   content::TestBrowserThread io_thread_; | 
| 146 | 146 | 
| 147   content::MockResourceContext resource_context_; | 147   content::MockResourceContext resource_context_; | 
| 148   scoped_ptr<TestIframeSource> source_; | 148   scoped_ptr<TestIframeSource> source_; | 
| 149   content::URLDataSource::GotDataCallback callback_; | 149   content::URLDataSource::GotDataCallback callback_; | 
| 150   scoped_refptr<InstantIOContext> instant_io_context_; | 150   scoped_refptr<InstantIOContext> instant_io_context_; | 
| 151   scoped_refptr<base::RefCountedMemory> response_; | 151   scoped_refptr<base::RefCountedMemory> response_; | 
| 152 }; | 152 }; | 
| 153 | 153 | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 190 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 190 TEST_F(IframeSourceTest, SendJSWithOrigin) { | 
| 191   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kInstantRendererPID, 0); | 191   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kInstantRendererPID, 0); | 
| 192   EXPECT_FALSE(response_string().empty()); | 192   EXPECT_FALSE(response_string().empty()); | 
| 193   EXPECT_NE(std::string::npos, response_string().find(kInstantOrigin)); | 193   EXPECT_NE(std::string::npos, response_string().find(kInstantOrigin)); | 
| 194   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kNonInstantRendererPID, 0); | 194   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kNonInstantRendererPID, 0); | 
| 195   EXPECT_FALSE(response_string().empty()); | 195   EXPECT_FALSE(response_string().empty()); | 
| 196   EXPECT_NE(std::string::npos, response_string().find(kNonInstantOrigin)); | 196   EXPECT_NE(std::string::npos, response_string().find(kNonInstantOrigin)); | 
| 197   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kInvalidRendererPID, 0); | 197   SendJSWithOrigin(IDR_OMNIBOX_RESULT_LOADER_JS, kInvalidRendererPID, 0); | 
| 198   EXPECT_TRUE(response_string().empty()); | 198   EXPECT_TRUE(response_string().empty()); | 
| 199 } | 199 } | 
| OLD | NEW | 
|---|