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 "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 "base/json/json_writer.h" | 8 #include "base/json/json_writer.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 EXPECT_TRUE(root->GetDictionary("result", &result)); | 89 EXPECT_TRUE(root->GetDictionary("result", &result)); |
90 result_.reset(result->DeepCopy()); | 90 result_.reset(result->DeepCopy()); |
91 base::MessageLoop::current()->QuitNow(); | 91 base::MessageLoop::current()->QuitNow(); |
92 } | 92 } |
93 | 93 |
94 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { | 94 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { |
95 EXPECT_TRUE(false); | 95 EXPECT_TRUE(false); |
96 } | 96 } |
97 }; | 97 }; |
98 | 98 |
99 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, QueryUsageAndQuota) { | |
100 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue); | |
101 params->SetString("securityOrigin", "http://example.com"); | |
102 SendCommand("Page.queryUsageAndQuota", params.Pass()); | |
103 | |
104 EXPECT_TRUE(HasValue("quota.persistent")); | |
105 EXPECT_TRUE(HasValue("quota.temporary")); | |
106 EXPECT_TRUE(HasListItem("usage.temporary", "id", "appcache")); | |
107 EXPECT_TRUE(HasListItem("usage.temporary", "id", "database")); | |
108 EXPECT_TRUE(HasListItem("usage.temporary", "id", "indexeddatabase")); | |
109 EXPECT_TRUE(HasListItem("usage.temporary", "id", "filesystem")); | |
110 EXPECT_TRUE(HasListItem("usage.persistent", "id", "filesystem")); | |
111 } | |
112 | |
113 class CaptureScreenshotTest : public DevToolsProtocolTest { | 99 class CaptureScreenshotTest : public DevToolsProtocolTest { |
114 private: | 100 private: |
115 #if !defined(OS_ANDROID) | 101 #if !defined(OS_ANDROID) |
116 void SetUpCommandLine(base::CommandLine* command_line) override { | 102 void SetUpCommandLine(base::CommandLine* command_line) override { |
117 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); | 103 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); |
118 } | 104 } |
119 #endif | 105 #endif |
120 }; | 106 }; |
121 | 107 |
122 // Does not link on Android | 108 // Does not link on Android |
(...skipping 20 matching lines...) Expand all Loading... |
143 SkBitmap bitmap; | 129 SkBitmap bitmap; |
144 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()), | 130 gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>(png.data()), |
145 png.size(), &bitmap); | 131 png.size(), &bitmap); |
146 SkColor color(bitmap.getColor(0, 0)); | 132 SkColor color(bitmap.getColor(0, 0)); |
147 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1); | 133 EXPECT_TRUE(std::abs(0x12-(int)SkColorGetR(color)) <= 1); |
148 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1); | 134 EXPECT_TRUE(std::abs(0x34-(int)SkColorGetG(color)) <= 1); |
149 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1); | 135 EXPECT_TRUE(std::abs(0x56-(int)SkColorGetB(color)) <= 1); |
150 } | 136 } |
151 | 137 |
152 } // namespace content | 138 } // namespace content |
OLD | NEW |