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

Side by Side Diff: content/browser/devtools/renderer_overrides_handler_browsertest.cc

Issue 442303002: DevTools: migrate DevTools APIs to use WebContents instead of RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments addressed. Created 6 years, 4 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 | Annotate | Revision Log
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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "content/browser/devtools/devtools_protocol.h" 8 #include "content/browser/devtools/devtools_protocol.h"
9 #include "content/public/browser/devtools_agent_host.h" 9 #include "content/public/browser/devtools_agent_host.h"
10 #include "content/public/browser/devtools_client_host.h" 10 #include "content/public/browser/devtools_client_host.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return true; 52 return true;
53 } 53 }
54 return false; 54 return false;
55 } 55 }
56 56
57 scoped_ptr<base::DictionaryValue> result_; 57 scoped_ptr<base::DictionaryValue> result_;
58 58
59 private: 59 private:
60 virtual void SetUpOnMainThread() OVERRIDE { 60 virtual void SetUpOnMainThread() OVERRIDE {
61 DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( 61 DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
62 DevToolsAgentHost::GetOrCreateFor( 62 DevToolsAgentHost::GetOrCreateFor(shell()->web_contents()).get(), this);
63 shell()->web_contents()->GetRenderViewHost()).get(),
64 this);
65 } 63 }
66 64
67 virtual void TearDownOnMainThread() OVERRIDE { 65 virtual void TearDownOnMainThread() OVERRIDE {
68 DevToolsManager::GetInstance()->ClientHostClosing(this); 66 DevToolsManager::GetInstance()->ClientHostClosing(this);
69 } 67 }
70 68
71 virtual void DispatchOnInspectorFrontend( 69 virtual void DispatchOnInspectorFrontend(
72 const std::string& message) OVERRIDE { 70 const std::string& message) OVERRIDE {
73 scoped_ptr<base::DictionaryValue> root( 71 scoped_ptr<base::DictionaryValue> root(
74 static_cast<base::DictionaryValue*>(base::JSONReader::Read(message))); 72 static_cast<base::DictionaryValue*>(base::JSONReader::Read(message)));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 SkBitmap bitmap; 127 SkBitmap bitmap;
130 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()), 128 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()),
131 png.size(), &bitmap); 129 png.size(), &bitmap);
132 SkColor color(bitmap.getColor(0, 0)); 130 SkColor color(bitmap.getColor(0, 0));
133 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1); 131 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1);
134 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1); 132 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1);
135 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1); 133 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1);
136 } 134 }
137 135
138 } // namespace content 136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698