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

Side by Side Diff: mojo/dart/embedder/test/validation_unittest.cc

Issue 1244823003: Remove dependency from //mojo to //crypto (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « mojo/dart/embedder/test/run_dart_tests.cc ('k') | mojo/edk/embedder/BUILD.gn » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "crypto/random.h" 16 #include "base/rand_util.h"
17 #include "mojo/dart/embedder/dart_controller.h" 17 #include "mojo/dart/embedder/dart_controller.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace mojo { 20 namespace mojo {
21 namespace dart { 21 namespace dart {
22 namespace { 22 namespace {
23 23
24 std::string GetPath() { 24 std::string GetPath() {
25 base::FilePath path; 25 base::FilePath path;
26 PathService::Get(base::DIR_SOURCE_ROOT, &path); 26 PathService::Get(base::DIR_SOURCE_ROOT, &path);
27 path = path.AppendASCII("mojo") 27 path = path.AppendASCII("mojo")
28 .AppendASCII("public") 28 .AppendASCII("public")
29 .AppendASCII("interfaces") 29 .AppendASCII("interfaces")
30 .AppendASCII("bindings") 30 .AppendASCII("bindings")
31 .AppendASCII("tests") 31 .AppendASCII("tests")
32 .AppendASCII("data") 32 .AppendASCII("data")
33 .AppendASCII("validation"); 33 .AppendASCII("validation");
34 34
35 return path.AsUTF8Unsafe(); 35 return path.AsUTF8Unsafe();
36 } 36 }
37 37
38 static bool generateEntropy(uint8_t* buffer, intptr_t length) { 38 static bool generateEntropy(uint8_t* buffer, intptr_t length) {
39 crypto::RandBytes(reinterpret_cast<void*>(buffer), length); 39 base::RandBytes(reinterpret_cast<void*>(buffer), length);
40 return true; 40 return true;
41 } 41 }
42 42
43 static void exceptionCallback(bool* exception, Dart_Handle error) { 43 static void exceptionCallback(bool* exception, Dart_Handle error) {
44 *exception = true; 44 *exception = true;
45 } 45 }
46 46
47 static void RunTest(const std::string& test) { 47 static void RunTest(const std::string& test) {
48 base::FilePath path; 48 base::FilePath path;
49 PathService::Get(base::DIR_SOURCE_ROOT, &path); 49 PathService::Get(base::DIR_SOURCE_ROOT, &path);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 EXPECT_FALSE(unhandled_exception); 87 EXPECT_FALSE(unhandled_exception);
88 } 88 }
89 89
90 TEST(DartTest, validation) { 90 TEST(DartTest, validation) {
91 RunTest(GetPath()); 91 RunTest(GetPath());
92 } 92 }
93 93
94 } // namespace 94 } // namespace
95 } // namespace dart 95 } // namespace dart
96 } // namespace mojo 96 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/dart/embedder/test/run_dart_tests.cc ('k') | mojo/edk/embedder/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698