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

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

Issue 667943003: Standardize usage of virtual/override/final in content/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
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/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if (id == value) 49 if (id == value)
50 return true; 50 return true;
51 } 51 }
52 return false; 52 return false;
53 } 53 }
54 54
55 scoped_ptr<base::DictionaryValue> result_; 55 scoped_ptr<base::DictionaryValue> result_;
56 scoped_refptr<DevToolsAgentHost> agent_host_; 56 scoped_refptr<DevToolsAgentHost> agent_host_;
57 57
58 private: 58 private:
59 virtual void SetUpOnMainThread() override { 59 void SetUpOnMainThread() override {
60 agent_host_ = DevToolsAgentHost::GetOrCreateFor(shell()->web_contents()); 60 agent_host_ = DevToolsAgentHost::GetOrCreateFor(shell()->web_contents());
61 agent_host_->AttachClient(this); 61 agent_host_->AttachClient(this);
62 } 62 }
63 63
64 virtual void TearDownOnMainThread() override { 64 void TearDownOnMainThread() override {
65 agent_host_->DetachClient(); 65 agent_host_->DetachClient();
66 agent_host_ = NULL; 66 agent_host_ = NULL;
67 } 67 }
68 68
69 virtual void DispatchProtocolMessage( 69 void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
70 DevToolsAgentHost* agent_host, const std::string& message) override { 70 const std::string& message) override {
71 scoped_ptr<base::DictionaryValue> root( 71 scoped_ptr<base::DictionaryValue> root(
72 static_cast<base::DictionaryValue*>(base::JSONReader::Read(message))); 72 static_cast<base::DictionaryValue*>(base::JSONReader::Read(message)));
73 base::DictionaryValue* result; 73 base::DictionaryValue* result;
74 EXPECT_TRUE(root->GetDictionary("result", &result)); 74 EXPECT_TRUE(root->GetDictionary("result", &result));
75 result_.reset(result->DeepCopy()); 75 result_.reset(result->DeepCopy());
76 base::MessageLoop::current()->QuitNow(); 76 base::MessageLoop::current()->QuitNow();
77 } 77 }
78 78
79 virtual void AgentHostClosed( 79 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override {
80 DevToolsAgentHost* agent_host, bool replaced) override {
81 EXPECT_TRUE(false); 80 EXPECT_TRUE(false);
82 } 81 }
83 }; 82 };
84 83
85 IN_PROC_BROWSER_TEST_F(RendererOverridesHandlerTest, QueryUsageAndQuota) { 84 IN_PROC_BROWSER_TEST_F(RendererOverridesHandlerTest, QueryUsageAndQuota) {
86 base::DictionaryValue* params = new base::DictionaryValue(); 85 base::DictionaryValue* params = new base::DictionaryValue();
87 params->SetString("securityOrigin", "http://example.com"); 86 params->SetString("securityOrigin", "http://example.com");
88 SendCommand("Page.queryUsageAndQuota", params); 87 SendCommand("Page.queryUsageAndQuota", params);
89 88
90 EXPECT_TRUE(HasValue("quota.persistent")); 89 EXPECT_TRUE(HasValue("quota.persistent"));
91 EXPECT_TRUE(HasValue("quota.temporary")); 90 EXPECT_TRUE(HasValue("quota.temporary"));
92 EXPECT_TRUE(HasListItem("usage.temporary", "id", "appcache")); 91 EXPECT_TRUE(HasListItem("usage.temporary", "id", "appcache"));
93 EXPECT_TRUE(HasListItem("usage.temporary", "id", "database")); 92 EXPECT_TRUE(HasListItem("usage.temporary", "id", "database"));
94 EXPECT_TRUE(HasListItem("usage.temporary", "id", "indexeddatabase")); 93 EXPECT_TRUE(HasListItem("usage.temporary", "id", "indexeddatabase"));
95 EXPECT_TRUE(HasListItem("usage.temporary", "id", "filesystem")); 94 EXPECT_TRUE(HasListItem("usage.temporary", "id", "filesystem"));
96 EXPECT_TRUE(HasListItem("usage.persistent", "id", "filesystem")); 95 EXPECT_TRUE(HasListItem("usage.persistent", "id", "filesystem"));
97 } 96 }
98 97
99 class CaptureScreenshotTest : public RendererOverridesHandlerTest { 98 class CaptureScreenshotTest : public RendererOverridesHandlerTest {
100 private: 99 private:
101 #if !defined(OS_ANDROID) 100 #if !defined(OS_ANDROID)
102 virtual void SetUpCommandLine(base::CommandLine* command_line) override { 101 void SetUpCommandLine(base::CommandLine* command_line) override {
103 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); 102 command_line->AppendSwitch(switches::kEnablePixelOutputInTests);
104 } 103 }
105 #endif 104 #endif
106 }; 105 };
107 106
108 // Does not link on Android 107 // Does not link on Android
109 #if defined(OS_ANDROID) 108 #if defined(OS_ANDROID)
110 #define MAYBE_CaptureScreenshot DISABLED_CaptureScreenshot 109 #define MAYBE_CaptureScreenshot DISABLED_CaptureScreenshot
111 #elif defined(MEMORY_SANITIZER) 110 #elif defined(MEMORY_SANITIZER)
112 // Also fails under MSAN. http://crbug.com/423583 111 // Also fails under MSAN. http://crbug.com/423583
(...skipping 14 matching lines...) Expand all
127 SkBitmap bitmap; 126 SkBitmap bitmap;
128 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()), 127 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()),
129 png.size(), &bitmap); 128 png.size(), &bitmap);
130 SkColor color(bitmap.getColor(0, 0)); 129 SkColor color(bitmap.getColor(0, 0));
131 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1); 130 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1);
132 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1); 131 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1);
133 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1); 132 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1);
134 } 133 }
135 134
136 } // namespace content 135 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.h ('k') | content/browser/devtools/tethering_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698